From efbe9809ccf5a5e1fcc3728424f2e788c0813248 Mon Sep 17 00:00:00 2001 From: Fenrir Date: Sun, 11 Feb 2018 16:34:21 -0700 Subject: [PATCH] Add documentation for Soc --- ctru-rs/src/services/soc.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ctru-rs/src/services/soc.rs b/ctru-rs/src/services/soc.rs index 1f11b6c..b87748c 100644 --- a/ctru-rs/src/services/soc.rs +++ b/ctru-rs/src/services/soc.rs @@ -2,15 +2,28 @@ use libctru::{socInit, socExit}; use libc::{memalign, free}; +/// Soc service. Initializing this service will enable the use of network sockets and utilities +/// such as those found in `std::net`. The service will be closed when this struct is is dropped. pub struct Soc { soc_mem: *mut u32, } impl Soc { + /// Initialize the Soc service with a default buffer size of 0x100000 bytes + /// + /// # Errors + /// + /// This function will return an error if the `Soc` service is already initialized pub fn init() -> ::Result { Soc::init_with_buffer_size(0x100000) } + /// Initialize the Soc service with a custom buffer size in bytes. The size should be + /// 0x100000 bytes or greater. + /// + /// # Errors + /// + /// This function will return an error if the `Soc` service is already initialized pub fn init_with_buffer_size(num_bytes: usize) -> ::Result { unsafe { let soc_mem = memalign(0x1000, num_bytes) as *mut u32;