Trait efs::fs::FileSystem

source ·
pub trait FileSystem<Dir: Directory> {
    // Required methods
    fn root(&self) -> Result<Dir, Error<Dir::Error>>;
    fn double_slash_root(&self) -> Result<Dir, Error<Dir::Error>>;

    // Provided methods
    fn get_file(
        &self,
        path: &Path<'_>,
        current_dir: Dir,
        symlink_resolution: bool
    ) -> Result<TypeWithFile<Dir>, Error<Dir::Error>>
       where Self: Sized { ... }
    fn create_file(
        &mut self,
        path: &Path<'_>,
        file_type: Type,
        permissions: Permissions,
        user_id: Uid,
        group_id: Gid
    ) -> Result<TypeWithFile<Dir>, Error<Dir::Error>>
       where Self: Sized { ... }
    fn remove_file(&mut self, path: Path<'_>) -> Result<(), Error<Dir::Error>>
       where Self: Sized { ... }
}
Expand description

A filesystem.

Required Methods§

source

fn root(&self) -> Result<Dir, Error<Dir::Error>>

Returns the root directory of the filesystem.

§Errors

Returns a DevError if the device could not be read.

source

fn double_slash_root(&self) -> Result<Dir, Error<Dir::Error>>

Returns the double slash root directory of the filesystem.

If you do not have any idea of what this is, you are probably looking for root.

See DoubleSlashRootDir and Path for more information.

§Errors

Returns a DevError if the device could not be read.

Provided Methods§

source

fn get_file( &self, path: &Path<'_>, current_dir: Dir, symlink_resolution: bool ) -> Result<TypeWithFile<Dir>, Error<Dir::Error>>
where Self: Sized,

Performs a pathname resolution as described in this POSIX definition.

Returns the file of this filesystem corresponding to the given path, starting at the current_dir.

symlink_resolution indicates whether the function calling this method is required to act on the symbolic link itself, or certain arguments direct that the function act on the symbolic link itself.

§Errors

Returns an NotFound error if the given path does not leed to an existing path.

Returns an NotDir error if one of the components of the file is not a directory.

Returns an Loop error if a loop is found during the symbolic link resolution.

Returns an NameTooLong error if the complete path contains more than PATH_MAX characters.

Returns an NoEnt error if an encountered symlink points to a non-existing file.

source

fn create_file( &mut self, path: &Path<'_>, file_type: Type, permissions: Permissions, user_id: Uid, group_id: Gid ) -> Result<TypeWithFile<Dir>, Error<Dir::Error>>
where Self: Sized,

Creates a new file with the given file_type at the given path.

§Errors

Returns a DevError if the device could not be read/written.

source

fn remove_file(&mut self, path: Path<'_>) -> Result<(), Error<Dir::Error>>
where Self: Sized,

Removes the file at the given path.

§Errors

Returns a DevError if the device could not be read/written.

Implementors§