/// Wrapper for [`std::fs::OpenOptions::open`](https://doc.rust-lang.org/std/fs/struct.OpenOptions.html#method.open) pubfn open<P>(&self, path: P) -> io::Result<crate::File> where
P: Into<PathBuf>,
{ // We have to either duplicate the logic or call the deprecated method here. // We can't let the deprecated function call this method, because we can't construct // `&fs_err::OpenOptions` from `&fs::OpenOptions` without cloning // (although cloning would probably be cheap). #[allow(deprecated)] crate::File::from_options(path.into(), self.options())
}
}
/// Returns a reference to the underlying [`std::fs::OpenOptions`](https://doc.rust-lang.org/stable/std/fs/struct.OpenOptions.html). /// /// Note that calling `open()` on this reference will NOT give you the improved errors from fs-err. pubfn options(&self) -> &fs::OpenOptions {
&self.0
}
/// Returns a mutable reference to the underlying [`std::fs::OpenOptions`](https://doc.rust-lang.org/stable/std/fs/struct.OpenOptions.html). /// /// This allows you to change settings that don't yet have wrappers in fs-err. /// Note that calling `open()` on this reference will NOT give you the improved errors from fs-err. pubfn options_mut(&mutself) -> &mut fs::OpenOptions {
&mutself.0
}
}
#[cfg(unix)] mod unix { usecrate::os::unix::fs::OpenOptionsExt; use std::os::unix::fs::OpenOptionsExt as _; impl OpenOptionsExt forcrate::OpenOptions { fn mode(&mutself, mode: u32) -> &mutSelf { self.options_mut().mode(mode); self
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.