Browse Source

Fix mutability issues after merge of master

pull/116/head
Ian Chamberlain 2 years ago committed by Andrea Ciliberti
parent
commit
3e349f8591
  1. 32
      ctru-rs/src/services/fs.rs

32
ctru-rs/src/services/fs.rs

@ -99,7 +99,7 @@ pub struct Fs(()); @@ -99,7 +99,7 @@ pub struct Fs(());
/// ```no_run
/// use ctru::services::fs::Fs;
///
/// let fs = Fs::new().unwrap();
/// let mut fs = Fs::init().unwrap();
/// let sdmc_archive = fs.sdmc().unwrap();
/// ```
pub struct Archive {
@ -125,8 +125,8 @@ pub struct Archive { @@ -125,8 +125,8 @@ pub struct Archive {
/// use std::io::prelude::*;
/// use ctru::services::fs::{Fs, File};
///
/// let fs = Fs::new()?;
/// let sdmc = fs.sdmc()?;
/// let mut fs = Fs::init()?;
/// let mut sdmc = fs.sdmc()?;
///
/// let mut file = File::create(&mut sdmc, "/foo.txt")?;
/// file.write_all(b"Hello, world!")?;
@ -144,8 +144,8 @@ pub struct Archive { @@ -144,8 +144,8 @@ pub struct Archive {
/// use std::io::prelude::*;
/// use ctru::services::fs::{Fs, File};
///
/// let fs = Fs::new()?;
/// let sdmc = fs.sdmc()?;
/// let mut fs = Fs::init()?;
/// let mut sdmc = fs.sdmc()?;
///
/// let mut file = File::open(&sdmc, "/foo.txt")?;
/// let mut contents = String::new();
@ -167,8 +167,8 @@ pub struct Archive { @@ -167,8 +167,8 @@ pub struct Archive {
/// use std::io::prelude::*;
/// use ctru::services::fs::{Fs, File};
///
/// let fs = Fs::new()?;
/// let sdmc = fs.sdmc()?;
/// let mut fs = Fs::init()?;
/// let mut sdmc = fs.sdmc()?;
///
/// let file = File::open(&sdmc, "/foo.txt")?;
/// let mut buf_reader = BufReader::new(file);
@ -223,8 +223,8 @@ pub struct Metadata { @@ -223,8 +223,8 @@ pub struct Metadata {
/// ```no_run
/// use ctru::services::fs::{Fs, OpenOptions};
///
/// let fs = Fs::new().unwrap();
/// let sdmc_archive = fs.sdmc().unwrap();
/// let mut fs = Fs::init().unwrap();
/// let mut sdmc_archive = fs.sdmc().unwrap();
/// let file = OpenOptions::new()
/// .read(true)
/// .archive(&sdmc_archive)
@ -238,8 +238,8 @@ pub struct Metadata { @@ -238,8 +238,8 @@ pub struct Metadata {
/// ```no_run
/// use ctru::services::fs::{Fs, OpenOptions};
///
/// let fs = Fs::new().unwrap();
/// let sdmc_archive = fs.sdmc().unwrap();
/// let mut fs = Fs::init().unwrap();
/// let mut sdmc_archive = fs.sdmc().unwrap();
/// let file = OpenOptions::new()
/// .read(true)
/// .write(true)
@ -365,8 +365,8 @@ impl File { @@ -365,8 +365,8 @@ impl File {
/// ```no_run
/// use ctru::services::fs::{Fs, File};
///
/// let fs = Fs::new().unwrap();
/// let sdmc_archive = fs.sdmc().unwrap();
/// let mut fs = Fs::init().unwrap();
/// let mut sdmc_archive = fs.sdmc().unwrap();
/// let mut f = File::open(&sdmc_archive, "/foo.txt").unwrap();
/// ```
pub fn open<P: AsRef<Path>>(arch: &Archive, path: P) -> IoResult<File> {
@ -394,9 +394,9 @@ impl File { @@ -394,9 +394,9 @@ impl File {
/// ```no_run
/// use ctru::services::fs::{Fs, File};
///
/// let fs = Fs::new().unwrap();
/// let sdmc_archive = fs.sdmc().unwrap();
/// let mut f = File::create(&sdmc_archive, "/foo.txt").unwrap();
/// let mut fs = Fs::init().unwrap();
/// let mut sdmc_archive = fs.sdmc().unwrap();
/// let mut f = File::create(&mut sdmc_archive, "/foo.txt").unwrap();
/// ```
pub fn create<P: AsRef<Path>>(arch: &mut Archive, path: P) -> IoResult<File> {
OpenOptions::new()

Loading…
Cancel
Save