Struct avrox_storage::fs::File

source ·
pub struct File<'f, FS>
where FS: 'static + FileSystemRead,
{ /* private fields */ }

Implementations§

source§

impl<'f, FS> File<'f, FS>
where FS: FileSystemRead,

source

pub fn open_on<F: Into<&'f FS>, P: Into<FS::FID>>( fs: F, path: P ) -> FileSystemResult<File<'f, FS>>

Open the identified file on the provided filesystem as read-only.

source

pub fn len(&self) -> FileSystemResult<FileAddr>

Return the length of this file, in bytes

source

pub fn read_dir<F: Into<&'f FS>, P: Into<FS::FID>>( fs: F, path: P ) -> FileSystemResult<ReadDir<'f, FS>>

Return an iterator over the entries in the given directory

source§

impl<'f, FS> File<'f, FS>
where FS: FileSystemWrite,

source

pub fn create_on<F: Into<&'f FS>, P: Into<FS::FID>>( fs: F, path: P ) -> FileSystemResult<File<'f, FS>>

Create the identified file on the provided filesystem. The file will be created if it does not exist, if it does already exist it will be truncated. The file is opened in write-only mode.

source

pub fn sync_all(&self) -> FileSystemResult<()>

source

pub fn sync_data(&self) -> FileSystemResult<()>

source

pub fn set_len(&self, size: FileAddr) -> FileSystemResult<()>

Trait Implementations§

source§

impl<'f, FS> Read for File<'f, FS>
where FS: FileSystemWrite,

source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

source§

fn read_exact(&mut self, buf: &mut [u8]) -> OxideResult<(), IoError>

source§

impl<'f, FS> Seek for File<'f, FS>
where FS: FileSystemWrite,

source§

fn seek(&mut self, pos: SeekFrom) -> Result<FileAddr>

source§

fn stream_position(&mut self) -> Result<FileAddr>

source§

fn rewind(&mut self) -> Result<()>

source§

impl<'f, FS> Write for File<'f, FS>
where FS: FileSystemWrite,

source§

fn flush(&mut self) -> Result<()>

source§

fn write_buffered(&mut self, buf: &[u8]) -> Result<usize>

source§

fn write(&mut self, buf: &[u8]) -> OxideResult<usize, IoError>

source§

fn write_all(&mut self, buf: &[u8]) -> OxideResult<(), IoError>

source§

impl<'f, FS> Send for File<'f, FS>
where FS: 'static + FileSystemRead + Sync,

Auto Trait Implementations§

§

impl<'f, FS> Freeze for File<'f, FS>
where <FS as FileSystemRead>::FID: Freeze,

§

impl<'f, FS> RefUnwindSafe for File<'f, FS>

§

impl<'f, FS> Sync for File<'f, FS>
where <FS as FileSystemRead>::FID: Sync, FS: Sync,

§

impl<'f, FS> Unpin for File<'f, FS>
where <FS as FileSystemRead>::FID: Unpin,

§

impl<'f, FS> UnwindSafe for File<'f, FS>

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.