@@ -346,9 +346,13 @@ pub trait OpenOptionsExt {
346
346
#[ stable( feature = "open_options_ext" , since = "1.10.0" ) ]
347
347
fn custom_flags ( & mut self , flags : i32 ) -> & mut Self ;
348
348
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`]
350
351
///
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
352
356
///
353
357
/// # Examples
354
358
///
@@ -359,16 +363,10 @@ pub trait OpenOptionsExt {
359
363
/// use std::fs::OpenOptions;
360
364
/// use std::os::unix::fs::OpenOptionsExt;
361
365
///
362
- /// # fn main() {
363
366
/// let mut options = OpenOptions::new();
364
367
/// options.write(true).read(true);
365
- /// if cfg!(unix) {
366
- /// options.custom_flags(libc::O_NOFOLLOW);
367
- /// }
368
368
/// 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()) };
372
370
/// ```
373
371
#[ stable( feature = "open_options_ext_as_flags" , since = "1.47.0" ) ]
374
372
fn as_flags ( & self ) -> io:: Result < libc:: c_int > ;
@@ -385,6 +383,7 @@ impl OpenOptionsExt for OpenOptions {
385
383
self . as_inner_mut ( ) . custom_flags ( flags) ;
386
384
self
387
385
}
386
+
388
387
fn as_flags ( & self ) -> io:: Result < libc:: c_int > {
389
388
self . as_inner ( ) . as_flags ( )
390
389
}
0 commit comments