Skip to main content

LocalFile

Struct LocalFile 

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

Implementations§

Source§

impl LocalFile

Source

pub async fn open( path: impl AsRef<Path>, create: bool, write: bool, read: bool, ) -> Result<Self>

Opens up a file at path. Will create the file if `create is true, otherwise will fail if missing.

  • Read permission is set by read.
  • Write permission is set by write.

Internally, the path will be canonicalized to a resolved, absolute path that can be used as reference when examining the local file.

Source

pub fn id(&self) -> u32

Source

pub fn sig(&self) -> u32

Source

pub fn handle(&self) -> LocalFileHandle

Source

pub fn permissions(&self) -> LocalFilePermissions

Source

pub fn path(&self) -> &Path

Source

pub async fn rename( &mut self, sig: u32, to: impl AsRef<Path>, ) -> Result<u32, LocalFileError>

Renames a file (if possible) using its underlying path as the origin

Source

pub async fn remove(&mut self, sig: u32) -> Result<(), LocalFileError>

Removes the file (if possible) using its underlying path

NOTE: If successful, this makes the local file reference no longer usable for the majority of its functionality

Source

pub async fn read_all(&mut self, sig: u32) -> Result<Vec<u8>, LocalFileError>

Reads all contents of file from beginning to end

Source

pub async fn write_all( &mut self, sig: u32, buf: &[u8], ) -> Result<(), LocalFileError>

Overwrites contents of file with provided contents

Trait Implementations§

Source§

impl Debug for LocalFile

Source§

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

Formats the value using the given formatter. Read more

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> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V