Struct SyncFileSystem

Source
pub struct SyncFileSystem { /* private fields */ }

Implementations§

Source§

impl SyncFileSystem

Source

pub const fn root_dir_id() -> EntryId

Source

pub fn num_blocks(&self) -> u64

Source

pub fn empty_blocks(&self) -> u64

Source

pub fn open_fs(block_device: Box<dyn SyncBlockDevice>) -> Result<Self, FsError>

Source

pub fn add_file( &mut self, parent_id: EntryId, name: &str, ) -> Result<EntryId, FsError>

Create a new file.

Source

pub fn add_directory( &mut self, parent_id: EntryId, name: &str, ) -> Result<EntryId, FsError>

Create a new directory.

Source

pub fn get_directory_entry( &mut self, parent: EntryId, pos: u64, ) -> Result<DirEntry, FsError>

Get a specific directory entry (child).

Source

pub fn get_directory_entry_by_name( &mut self, parent: EntryId, name: &str, ) -> Result<DirEntry, FsError>

Source

pub fn get_num_entries(&mut self, dir: EntryId) -> Result<u64, FsError>

Get the number of directory entries (children).

Source

pub fn get_file_size(&mut self, file: EntryId) -> Result<u64, FsError>

Get file size.

Source

pub fn stat(&mut self, entry: EntryId) -> Result<Attr, FsError>

Source

pub fn set_file_size( &mut self, file_id: EntryId, new_size: u64, ) -> Result<(), FsError>

Source

pub fn get_parent( &mut self, entry_id: EntryId, ) -> Result<Option<EntryId>, FsError>

Source

pub fn get_name(&mut self, entry_id: EntryId) -> Result<String, FsError>

Source

pub fn move_rename( &mut self, entry_id: EntryId, new_parent: EntryId, new_name: &str, ) -> Result<(), FsError>

Source

pub fn remove(&mut self, entry_id: EntryId) -> Result<(), FsError>

Source

pub fn write( &mut self, file_id: EntryId, offset: u64, buf: &[u8], ) -> Result<usize, FsError>

Write buf to file at offset. At most 4096 bytes will be written.

A write may succeed with the resulting usize less than buf.len; this usually happens when the write would otherwise cross a block boundary. Just do another write for the remaining bytes then.

Source

pub fn read( &mut self, file_id: EntryId, offset: u64, buf: &mut [u8], ) -> Result<usize, FsError>

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

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.