VowFileAsync

Trait VowFileAsync 

Source
pub trait VowFileAsync: MaybeSend {
    // Required methods
    fn open(path: &Path) -> impl IoFut<Self>
       where Self: Sized;
    fn read(&mut self, buf: Vec<u8>) -> impl BufFut;
    fn write(&mut self, buf: Vec<u8>) -> impl BufFut;
    fn flush(&mut self) -> impl IoFut<()>;
    fn set_len(&mut self, len: u64) -> impl IoFut<()>;
}
Expand description

Low-level trait for asynchronous file operations

Required Methods§

Source

fn open(path: &Path) -> impl IoFut<Self>
where Self: Sized,

Open a new file at the given path asynchronously

Source

fn read(&mut self, buf: Vec<u8>) -> impl BufFut

Read entire file into a buffer

Source

fn write(&mut self, buf: Vec<u8>) -> impl BufFut

Write entire buffer into a file

Source

fn flush(&mut self) -> impl IoFut<()>

Flush the file

Source

fn set_len(&mut self, len: u64) -> impl IoFut<()>

Set the length of the file

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl VowFileAsync for File

Available on crate feature backend-async-std only.
Source§

fn open(path: &Path) -> impl IoFut<Self>
where Self: Sized,

Source§

fn read(&mut self, buf: Vec<u8>) -> impl BufFut

Source§

fn write(&mut self, buf: Vec<u8>) -> impl BufFut

Source§

fn flush(&mut self) -> impl IoFut<()>

Source§

fn set_len(&mut self, len: u64) -> impl IoFut<()>

Source§

impl VowFileAsync for File

Available on crate feature backend-compio only.
Source§

fn open(path: &Path) -> impl IoFut<Self>
where Self: Sized,

Source§

fn read(&mut self, buf: Vec<u8>) -> impl BufFut

Source§

fn write(&mut self, buf: Vec<u8>) -> impl BufFut

Source§

fn flush(&mut self) -> impl IoFut<()>

Source§

fn set_len(&mut self, len: u64) -> impl IoFut<()>

Source§

impl VowFileAsync for File

Available on crate feature backend-tokio only.
Source§

fn open(path: &Path) -> impl IoFut<Self>
where Self: Sized,

Source§

fn read(&mut self, buf: Vec<u8>) -> impl BufFut

Source§

fn write(&mut self, buf: Vec<u8>) -> impl BufFut

Source§

fn flush(&mut self) -> impl IoFut<()>

Source§

fn set_len(&mut self, len: u64) -> impl IoFut<()>

Implementors§