Struct File

Source
pub struct File<'a, B: BlockDevice, S: FileSync = Safe> { /* private fields */ }

Implementations§

Source§

impl<'a, B: BlockDevice> File<'a, B, Safe>

Source

pub unsafe fn into_unsafe(self) -> File<'a, B, Unsafe>

Remove the locking requirement for file Read/Writes.

Use only if sure that reads/writes will not happen on the same or multiple files by different cores at the same.

Source

pub unsafe fn into_reader(self) -> Result<Reader<'a, B>, DeviceError>

Transform the File into a high-speed Reader with better caching and locking mechanisms.

Source§

impl<'a, B: BlockDevice> File<'a, B, Unsafe>

Source

pub fn into_safe(self) -> File<'a, B, Safe>

Source§

impl<'a, B: BlockDevice, S: FileSync> File<'a, B, S>

Source

pub fn cursor(&self) -> usize

Source

pub fn is_dirty(&self) -> bool

Source

pub fn available(&self) -> usize

Source

pub fn is_readable(&self) -> bool

Source

pub fn is_writeable(&self) -> bool

Source

pub fn is_allocated(&self) -> bool

Source

pub fn volume(&self) -> &Volume<'a, B>

Source

pub fn delete(self) -> Result<(), DeviceError>

Source

pub fn close(self) -> Result<(), DeviceError>

Source

pub fn flush(&mut self) -> Result<(), DeviceError>

Source

pub fn write(&mut self, b: &[u8]) -> Result<usize, DeviceError>

Source

pub fn truncate(&mut self, pos: usize) -> Result<(), DeviceError>

Does not save the file and keeps the current Cluster intact. To fully truncate a File entry, it must be opened with ‘Mode::TRUNCATE’.

Source

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

Methods from Deref<Target = DirEntry>§

Source

pub fn size(&self) -> u32

Source

pub fn name(&self) -> &str

Source

pub fn offset(&self) -> u32

Source

pub fn is_file(&self) -> bool

Source

pub fn created(&self) -> &Time

Source

pub fn attributes(&self) -> u8

Source

pub fn modified(&self) -> &Time

Source

pub fn cluster(&self) -> Cluster

Source

pub fn is_directory(&self) -> bool

Source

pub fn filename(&self) -> &ShortName

Trait Implementations§

Source§

impl<B: BlockDevice, S: FileSync> Deref for File<'_, B, S>

Source§

type Target = DirEntry

The resulting type after dereferencing.
Source§

fn deref(&self) -> &DirEntry

Dereferences the value.
Source§

impl<B: BlockDevice, S: FileSync> Drop for File<'_, B, S>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<B: BlockDevice, S: FileSync> Read<DeviceError> for File<'_, B, S>

Source§

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

Source§

fn read_exact(&mut self, b: &mut [u8]) -> Result<(), Error<E>>

Source§

impl<B: BlockDevice, S: FileSync> Seek<DeviceError> for File<'_, B, S>

Source§

fn seek(&mut self, s: SeekFrom) -> Result<u64, Error>

Source§

fn rewind(&mut self) -> Result<(), Error<E>>

Source§

fn stream_position(&mut self) -> Result<u64, Error<E>>

Source§

impl<B: BlockDevice, S: FileSync> Write<DeviceError> for File<'_, B, S>

Source§

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

Source§

fn write(&mut self, b: &[u8]) -> Result<usize, Error>

Source§

fn write_all(&mut self, b: &[u8]) -> Result<(), Error<E>>

Source§

fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>

Auto Trait Implementations§

§

impl<'a, B, S> Freeze for File<'a, B, S>

§

impl<'a, B, S = Safe> !RefUnwindSafe for File<'a, B, S>

§

impl<'a, B, S = Safe> !Send for File<'a, B, S>

§

impl<'a, B, S = Safe> !Sync for File<'a, B, S>

§

impl<'a, B, S> Unpin for File<'a, B, S>

§

impl<'a, B, S = Safe> !UnwindSafe for File<'a, B, S>

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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<D> Reader for D