Struct obnth::OpenOptions [−][src]
A struct that can be used to open files within a directory.
This is directly analogous to std::fs::OpenOptions
, except that it only looks up files within
a specific Dir
.
An OpenOptions
struct can be created with Dir::open_file()
.
Implementations
impl<'a> OpenOptions<'a>
[src]
pub fn read(&mut self, read: bool) -> &mut Self
[src]
Enable the option for read access.
pub fn write(&mut self, write: bool) -> &mut Self
[src]
Enable the option for write access.
pub fn create(&mut self, create: bool) -> &mut Self
[src]
Create the a new file if it does not exist.
pub fn create_new(&mut self, create_new: bool) -> &mut Self
[src]
Create a new file, failing if it already exists.
This is atomic. Enabling it causes .create()
and .truncate()
to be ignored.
pub fn append(&mut self, append: bool) -> &mut Self
[src]
Enable append mode.
pub fn truncate(&mut self, truncate: bool) -> &mut Self
[src]
If the file already exists, truncate it while opening.
pub fn mode(&mut self, mode: u32) -> &mut Self
[src]
Set the mode with which the file will be opened (e.g 0o777
).
The OS will mask out the system umask value.
pub fn custom_flags(&mut self, flags: c_int) -> &mut Self
[src]
Pass custom flags when opening the file.
Like std::fs::OpenOptions
, O_ACCMODE
is masked out from the given flags.
pub fn lookup_flags(&mut self, lookup_flags: LookupFlags) -> &mut Self
[src]
Set the "lookup flags" used when opening the file.
See LookupFlags
for more information. (By default, none of the "lookup flags" are
enabled.)
pub fn open<P: AsPath>(&self, path: P) -> Result<File>
[src]
Open the file at path
with the options specified by path
.
Trait Implementations
impl<'a> Clone for OpenOptions<'a>
[src]
fn clone(&self) -> OpenOptions<'a>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> Debug for OpenOptions<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for OpenOptions<'a>
[src]
impl<'a> Send for OpenOptions<'a>
[src]
impl<'a> Sync for OpenOptions<'a>
[src]
impl<'a> Unpin for OpenOptions<'a>
[src]
impl<'a> UnwindSafe for OpenOptions<'a>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,