Struct axfs::fops::Directory

source ·
pub struct Directory { /* private fields */ }
Expand description

An opened directory object, with open permissions and a cursor for read_dir.

Implementations§

source§

impl Directory

source

pub fn open_dir(path: &str, opts: &OpenOptions) -> AxResult<Self>

Opens a directory at the path relative to the current directory. Returns a Directory object.

source

pub fn open_dir_at(&self, path: &str, opts: &OpenOptions) -> AxResult<Self>

Opens a directory at the path relative to this directory. Returns a Directory object.

source

pub fn open_file_at(&self, path: &str, opts: &OpenOptions) -> AxResult<File>

Opens a file at the path relative to this directory. Returns a File object.

source

pub fn create_file(&self, path: &str) -> AxResult<VfsNodeRef>

Creates an empty file at the path relative to this directory.

source

pub fn create_dir(&self, path: &str) -> AxResult

Creates an empty directory at the path relative to this directory.

source

pub fn remove_file(&self, path: &str) -> AxResult

Removes a file at the path relative to this directory.

source

pub fn remove_dir(&self, path: &str) -> AxResult

Removes a directory at the path relative to this directory.

source

pub fn read_dir(&mut self, dirents: &mut [DirEntry]) -> AxResult<usize>

Reads directory entries starts from the current position into the given buffer. Returns the number of entries read.

After the read, the cursor will be advanced by the number of entries read.

source

pub fn rename(&self, old: &str, new: &str) -> AxResult

Rename a file or directory to a new name. Delete the original file if old already exists.

This only works then the new path is in the same mounted fs.

Trait Implementations§

source§

impl Drop for Directory

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.