[][src]Struct posix_acl::PosixACL

pub struct PosixACL { /* fields omitted */ }

The ACL of a file.

Methods

impl PosixACL[src]

pub fn new(file_mode: u32) -> PosixACL[src]

Convert a file mode ("chmod" number) into an ACL. This is the primary constructor. Note that modes are usually expressed in Octal, e.g. PosixACL::new(0o644)

This creates the minimal required entries. By the POSIX ACL spec, every valid ACL must contain at least four entries: UserObj, GroupObj, Mask and Other.

Bits higher than 9 (e.g. SUID flag, etc) are ignored.

pub fn empty() -> PosixACL[src]

Create an empty ACL. NB! Empty ACLs are NOT considered valid.

pub fn with_capacity(capacity: usize) -> PosixACL[src]

Create an empty ACL with capacity. NB! Empty ACLs are NOT considered valid.

pub fn read_acl(path: &Path) -> Result<PosixACL, SimpleError>[src]

Read a file's ACL and return as PosixACL object.

pub fn write_acl(&mut self, path: &Path) -> Result<(), SimpleError>[src]

Write the current ACL to a file. Overwrites any existing ACL on the file.

Automatically re-calculates the Mask entry and calls validation.

pub fn entries(&self) -> Vec<ACLEntry>[src]

Get all ACLEntry items. The POSIX ACL API does not allow multiple parallel iterators so we return a materialized vector just to be safe.

pub fn set(&mut self, qual: Qualifier, perm: u32)[src]

Set the permission of qual to perm. If this qual already exists, it is updated, otherwise a new one is added.

perm must be a combination of the ACL_ constants, combined by binary OR.

pub fn get(&self, qual: Qualifier) -> Option<u32>[src]

Get the current perm value of qual, if any.

pub fn remove(&self, qual: Qualifier) -> Option<u32>[src]

Remove entry with matching qual. If found, returns the matching perm, otherwise None

pub fn fix_mask(&mut self)[src]

Re-calculate the Qualifier::Mask entry. This is automatically done during write_acl().

pub fn as_text(&self) -> String[src]

Return the textual representation of the ACL. Individual entries are separated by newline ('\n').

pub fn validate(&self) -> Result<(), SimpleError>[src]

Call the platform's validation function. Unfortunately it is not possible to provide detailed error messages.

Trait Implementations

impl Drop for PosixACL[src]

impl PartialEq<PosixACL> for PosixACL[src]

Auto Trait Implementations

impl RefUnwindSafe for PosixACL

impl !Send for PosixACL

impl !Sync for PosixACL

impl Unpin for PosixACL

impl UnwindSafe for PosixACL

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, 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.