Enum Data

Source
pub enum Data<'a> {
    File(File<'a>),
    Dir(Dir<'a>),
    Symlink(PathBuf),
    BlockDev(u32, u32),
    CharDev(u32, u32),
    Fifo,
    Socket,
}
Expand description

Enum type for the various kinds of data that an inode can be.

This is retrieved by calling Node::data and can be matched to determine the type and contents of a node.

For accessing files and directories, Node provides the as_dir and as_file methods to bypass Data completely.

Variants§

§

File(File<'a>)

A regular file, containing a File object that can be used to extract the file contents.

§

Dir(Dir<'a>)

A directory, containing a Dir that can be used to access the directory’s children.

A symbolic link, containing the target of the link as a PathBuf.

§

BlockDev(u32, u32)

A block device file, containing the device’s major and minor numbers.

§

CharDev(u32, u32)

A character device file, containing the device’s major and minor numbers.

§

Fifo

A named pipe.

§

Socket

A socket.

Implementations§

Source§

impl<'a> Data<'a>

Source

pub fn name(&self) -> String

Get a human-readable English name for the type of file represented by this object, intended primarily for debugging.

Trait Implementations§

Source§

impl<'a> Debug for Data<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !Freeze for Data<'a>

§

impl<'a> RefUnwindSafe for Data<'a>

§

impl<'a> !Send for Data<'a>

§

impl<'a> !Sync for Data<'a>

§

impl<'a> Unpin for Data<'a>

§

impl<'a> UnwindSafe for Data<'a>

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

Source§

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

Source§

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.
Source§

impl<T> Erased for T