Update docs of OpenOptions::as_flags

This commit is contained in:
Federico Ponzi 2020-09-02 10:48:11 +02:00
parent 7c1e5c1dcd
commit 321b680fe6
No known key found for this signature in database
GPG key ID: CFA9CCFE5363D0C6
2 changed files with 3 additions and 3 deletions

View file

@ -346,10 +346,9 @@ pub trait OpenOptionsExt {
#[stable(feature = "open_options_ext", since = "1.10.0")] #[stable(feature = "open_options_ext", since = "1.10.0")]
fn custom_flags(&mut self, flags: i32) -> &mut Self; fn custom_flags(&mut self, flags: i32) -> &mut Self;
/// Get the flags of this OpenOptions as [`libc::c_int`]. /// Get the flags as [`libc::c_int`].
/// With: [`libc::open`]
/// ///
/// This method allows the reuse of the OpenOptions as flags argument for [`fs::OpenOptions`]. /// This method allows the reuse of the OpenOptions as flags argument for [`libc::open`].
/// ///
/// [`libc::c_int`]: https://docs.rs/libc/*/libc/type.c_int.html /// [`libc::c_int`]: https://docs.rs/libc/*/libc/type.c_int.html
/// [`libc::open`]: https://docs.rs/libc/*/libc/fn.open.html /// [`libc::open`]: https://docs.rs/libc/*/libc/fn.open.html

View file

@ -655,6 +655,7 @@ impl OpenOptions {
pub fn mode(&mut self, mode: u32) { pub fn mode(&mut self, mode: u32) {
self.mode = mode as mode_t; self.mode = mode as mode_t;
} }
pub fn as_flags(&self) -> io::Result<c_int> { pub fn as_flags(&self) -> io::Result<c_int> {
let access_mode = self.get_access_mode()?; let access_mode = self.get_access_mode()?;
let creation_mode = self.get_creation_mode()?; let creation_mode = self.get_creation_mode()?;