aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFenrir <[email protected]>2018-02-11 16:34:21 -0700
committerFenrirWolf <[email protected]>2018-02-11 16:34:51 -0700
commitefbe9809ccf5a5e1fcc3728424f2e788c0813248 (patch)
treecf7929a812192595178d51e46ccff2beb16fd898
parentAdd Soc::init_with_buffer_size (diff)
downloadarchived-ctru-rs-efbe9809ccf5a5e1fcc3728424f2e788c0813248.tar.xz
archived-ctru-rs-efbe9809ccf5a5e1fcc3728424f2e788c0813248.zip
Add documentation for Soc
-rw-r--r--ctru-rs/src/services/soc.rs13
1 files changed, 13 insertions, 0 deletions
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> {
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<Soc> {
unsafe {
let soc_mem = memalign(0x1000, num_bytes) as *mut u32;