[][src]Struct pathrs::OpenFlags

pub struct OpenFlags(pub c_int);

Wrapper for the underlying libc's O_* flags.

The flag values and their meaning is identical to the description in the open(2) man page.

Caveats

For historical reasons, the first three bits of open(2)'s flags are for the access mode and are actually treated as a 2-bit number. So, it is incorrect to attempt to do any checks on the access mode without masking it correctly. So some helpers were added to make usage more ergonomic.

Methods

impl OpenFlags[src]

pub fn access_mode(self) -> c_int[src]

Grab the access mode bits from the flags.

pub fn wants_read(self) -> bool[src]

Does the access mode imply read access?

pub fn wants_write(self) -> bool[src]

Does the access mode imply write access? Note that there are several other bits (such as O_TRUNC) which imply write access but are not part of the access mode, and thus a false value from .wants_write() does not guarantee that the kernel will not do a MAY_WRITE check.

Trait Implementations

impl Clone for OpenFlags[src]

impl Copy for OpenFlags[src]

impl Debug for OpenFlags[src]

impl Eq for OpenFlags[src]

impl From<i32> for OpenFlags[src]

impl PartialEq<OpenFlags> for OpenFlags[src]

impl StructuralEq for OpenFlags[src]

impl StructuralPartialEq for OpenFlags[src]

Auto Trait Implementations

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.