[][src]Struct fs::FsPool

pub struct FsPool { /* fields omitted */ }

A pool of threads to handle file IO.

Methods

impl FsPool[src]

pub fn new(threads: usize) -> Self[src]

Creates a new FsPool, with the supplied number of threads.

pub fn with_executor<E>(executor: E) -> Self where
    E: Executor<Box<dyn Future<Item = (), Error = ()> + Send>> + Send + Sync + 'static, 
[src]

Creates a new FsPool, from an existing Executor.

Note

The executor will be used to spawn tasks that can block the thread. It likely should not be an executor that is also handling light-weight tasks, but a dedicated thread pool.

The most common use of this constructor is to allow creating a single CpuPool for your application for blocking tasks, and sharing it with FsPool and any other things needing a thread pool.

pub fn read<P>(&self, path: P, opts: ReadOptions) -> FsReadStream where
    P: AsRef<Path> + Send + 'static, 
[src]

Returns a Stream of the contents of the file at the supplied path.

pub fn read_file(&self, file: File, opts: ReadOptions) -> FsReadStream[src]

Returns a Stream of the contents of the supplied file.

pub fn write<P>(&self, path: P, opts: WriteOptions) -> FsWriteSink where
    P: AsRef<Path> + Send + 'static, 
[src]

Returns a Sink to send bytes to be written to the file at the supplied path.

pub fn write_file(&self, file: File) -> FsWriteSink[src]

Returns a Sink to send bytes to be written to the supplied file.

pub fn delete<P>(&self, path: P) -> FsFuture<()> where
    P: AsRef<Path> + Send + 'static, 
[src]

Returns a Future that resolves when the target file is deleted.

Trait Implementations

impl Clone for FsPool[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Default for FsPool[src]

impl Debug for FsPool[src]

Auto Trait Implementations

impl Send for FsPool

impl Sync for FsPool

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]