aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;