@@ -346,9 +346,13 @@ pub trait OpenOptionsExt {
346346 #[ stable( feature = "open_options_ext" , since = "1.10.0" ) ]
347347 fn custom_flags ( & mut self , flags : i32 ) -> & mut Self ;
348348
349- /// Get the flags of this OpenOptions as libc::c_int.
349+ /// Get the flags of this OpenOptions as [`libc::c_int`].
350+ /// With: [`libc::open`]
350351 ///
351- /// This method allows the reuse of the OpenOptions as flags argument for `libc::open()`.
352+ /// This method allows the reuse of the OpenOptions as flags argument for [`fs::OpenOptions`].
353+ ///
354+ /// [`libc::c_int`]: https://docs.rs/libc/*/libc/type.c_int.html
355+ /// [`libc::open`]: https://docs.rs/libc/*/libc/fn.open.html
352356 ///
353357 /// # Examples
354358 ///
@@ -359,16 +363,10 @@ pub trait OpenOptionsExt {
359363 /// use std::fs::OpenOptions;
360364 /// use std::os::unix::fs::OpenOptionsExt;
361365 ///
362- /// # fn main() {
363366 /// let mut options = OpenOptions::new();
364367 /// options.write(true).read(true);
365- /// if cfg!(unix) {
366- /// options.custom_flags(libc::O_NOFOLLOW);
367- /// }
368368 /// let file_name = CString::new("foo.txt").unwrap();
369- /// let file = unsafe{ libc::open(file_name.as_c_str().as_ptr(), options.as_flags().unwrap()) };
370- ///
371- /// # }
369+ /// let file = unsafe { libc::open(file_name.as_c_str().as_ptr(), options.as_flags().unwrap()) };
372370 /// ```
373371 #[ stable( feature = "open_options_ext_as_flags" , since = "1.47.0" ) ]
374372 fn as_flags ( & self ) -> io:: Result < libc:: c_int > ;
@@ -385,6 +383,7 @@ impl OpenOptionsExt for OpenOptions {
385383 self . as_inner_mut ( ) . custom_flags ( flags) ;
386384 self
387385 }
386+
388387 fn as_flags ( & self ) -> io:: Result < libc:: c_int > {
389388 self . as_inner ( ) . as_flags ( )
390389 }
0 commit comments