Struct obnth::OpenOptions[][src]

pub struct OpenOptions<'a> { /* fields omitted */ }

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]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.