DirectoryBlockEntry

Struct DirectoryBlockEntry 

Source
#[repr(C)]
pub struct DirectoryBlockEntry { pub inode: Option<InodeNumber>, pub name_len: u8, pub name: [u8; 251], }
Expand description

Represent a single directory entry within a directory block.

Each entry stores metadata for necessary to locate a file or subdirectory.

Fields§

§inode: Option<InodeNumber>

The inode associated with this directory entry.

  • Some(inode): a valid file or directory.
  • None: an unused or deleted entry.
§name_len: u8

The length of the file or directory name stored in name. This indicates how many bytes in the name array are valid.

§name: [u8; 251]

The name of the file or directory. Only the first name_len bytes are meaningful.

Implementations§

Source§

impl DirectoryBlockEntry

Source

pub fn from_ino_name(ino: InodeNumber, name: &str) -> Option<Self>

Constructs a new directory entry from an inode number and name.

Returns None if the name is too long to fit in the directory entry.

§Arguments
  • ino: The inode number associated with the entry.
  • name: The name of the file or directory.
§Returns
  • Some(Self): A valid directory entry.
  • None: If the name is too long to fit.
Source

pub fn name(&self) -> Option<&str>

Returns the name of the directory entry as a string slice.

§Returns
  • Some(&str): If the name is valid UTF-8.
  • None: If the name contains invalid UTF-8 bytes.

Trait Implementations§

Source§

impl Clone for DirectoryBlockEntry

Source§

fn clone(&self) -> DirectoryBlockEntry

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DirectoryBlockEntry

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for DirectoryBlockEntry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Copy for DirectoryBlockEntry

Auto Trait Implementations§

§

impl Freeze for DirectoryBlockEntry

§

impl RefUnwindSafe for DirectoryBlockEntry

§

impl Send for DirectoryBlockEntry

§

impl Sync for DirectoryBlockEntry

§

impl Unpin for DirectoryBlockEntry

§

impl UnwindSafe for DirectoryBlockEntry

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

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

Performs the conversion.