diff --git a/ctru-rs/src/services/fs.rs b/ctru-rs/src/services/fs.rs index 45f9efb..058eb14 100644 --- a/ctru-rs/src/services/fs.rs +++ b/ctru-rs/src/services/fs.rs @@ -123,6 +123,9 @@ pub struct Archive { /// Create a new file and write bytes to it: /// /// ```no_run +/// # use std::error::Error; +/// # fn main() -> Result<(), Box> { +/// # /// use std::io::prelude::*; /// use ctru::services::fs::{Fs, File}; /// @@ -131,11 +134,17 @@ pub struct Archive { /// /// let mut file = File::create(&sdmc, "/foo.txt")?; /// file.write_all(b"Hello, world!")?; +/// # +/// # Ok(()) +/// # } /// ``` /// /// Read the contents of a file into a `String`:: /// /// ```no_run +/// # use std::error::Error; +/// # fn main() -> Result<(), Box> { +/// # /// use std::io::prelude::*; /// use ctru::services::fs::{Fs, File}; /// @@ -146,12 +155,18 @@ pub struct Archive { /// let mut contents = String::new(); /// file.read_to_string(&mut contents)?; /// assert_eq!(contents, "Hello, world!"); +/// # +/// # Ok(()) +/// # } /// ``` /// /// It can be more efficient to read the contents of a file with a buffered /// `Read`er. This can be accomplished with `BufReader`: /// /// ```no_run +/// # use std::error::Error; +/// # fn main() -> Result<(), Box> { +/// # /// use std::io::BufReader; /// use std::io::prelude::*; /// use ctru::services::fs::{Fs, File}; @@ -164,6 +179,9 @@ pub struct Archive { /// let mut contents = String::new(); /// buf_reader.read_to_string(&mut contents)?; /// assert_eq!(contents, "Hello, world!"); +/// # +/// # Ok(()) +/// # } /// ``` pub struct File { handle: u32,