From 6c6c09439953b2ed89e2047d45bd9330e51ec285 Mon Sep 17 00:00:00 2001 From: Ian Chamberlain Date: Mon, 3 Apr 2023 13:13:14 -0400 Subject: [PATCH] Fix build errors in FS examples --- ctru-rs/src/services/fs.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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,