Struct File

Source
pub struct File<Access: AccessMode = ReadWrite> { /* private fields */ }
Available on Linux only.
Expand description

An open file, allowing for reading and writing according to the associated AccessMode. The underlying file is guaranteed to exist for the lifetime of the File.

Implementations§

Source§

impl<A: AccessMode> File<A>

Source§

impl File<ReadWrite>

Source

pub fn open<P: AsRef<Path<Abs>>>( file_path: P, ) -> Result<File<ReadWrite>, RawOsError>

Source

pub fn create<P: AsRef<Path<Abs>>>( file_path: P, file_mode: u16, ) -> Result<File<ReadWrite>, RawOsError>

Source

pub fn open_or_create<P: AsRef<Path<Abs>>>( file_path: P, file_mode: u16, ) -> Result<File<ReadWrite>, RawOsError>

Source

pub fn open_rel<P: AsRef<Path<Rel>>>( relative_to: &Directory, file_path: P, ) -> Result<File<ReadWrite>, RawOsError>

Source

pub fn create_rel<P: AsRef<Path<Rel>>>( relative_to: &Directory, file_path: P, file_mode: u16, ) -> Result<File<ReadWrite>, RawOsError>

Source

pub fn open_or_create_rel<P: AsRef<Path<Rel>>>( relative_to: &Directory, file_path: P, file_mode: u16, ) -> Result<File<ReadWrite>, RawOsError>

Source

pub fn create_temp() -> Result<File<ReadWrite>, RawOsError>

Source§

impl<A: Read> File<A>

Source

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

Source

pub fn read_all_vec(&self) -> Result<Vector<u8>, RawOsError>

Source

pub fn read_all_string(&self) -> Result<String, RawOsError>

Source§

impl<A: Write> File<A>

Source

pub fn write(&self, buf: &[u8]) -> Result<usize, RawOsError>

Trait Implementations§

Source§

impl<A: AccessMode> Debug for File<A>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Access> Freeze for File<Access>

§

impl<Access> RefUnwindSafe for File<Access>

§

impl<Access> Send for File<Access>

§

impl<Access> Sync for File<Access>

§

impl<Access> Unpin for File<Access>

§

impl<Access> UnwindSafe for File<Access>

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.