Struct futures_fs::FsPool [−][src]
pub struct FsPool { /* fields omitted */ }
A pool of threads to handle file IO.
Methods
impl FsPool
[src]
impl FsPool
pub fn new(threads: usize) -> Self
[src]
pub fn new(threads: usize) -> Self
Creates a new FsPool
, with the supplied number of threads.
pub fn with_executor<E>(executor: E) -> Self where
E: Executor<Box<Future<Item = (), Error = ()> + Send>> + Send + Sync + 'static,
[src]
pub fn with_executor<E>(executor: E) -> Self where
E: Executor<Box<Future<Item = (), Error = ()> + Send>> + Send + Sync + 'static,
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]
pub fn read<P>(&self, path: P, opts: ReadOptions) -> FsReadStream where
P: AsRef<Path> + Send + 'static,
Returns a Stream
of the contents of the file at the supplied path.
pub fn read_file(&self, file: File, opts: ReadOptions) -> FsReadStream
[src]
pub fn read_file(&self, file: File, opts: ReadOptions) -> FsReadStream
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]
pub fn write<P>(&self, path: P, opts: WriteOptions) -> FsWriteSink where
P: AsRef<Path> + Send + 'static,
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]
pub fn write_file(&self, file: File) -> FsWriteSink
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]
pub fn delete<P>(&self, path: P) -> FsFuture<()> where
P: AsRef<Path> + Send + 'static,
Returns a Future
that resolves when the target file is deleted.
Trait Implementations
impl Clone for FsPool
[src]
impl Clone for FsPool
fn clone(&self) -> FsPool
[src]
fn clone(&self) -> FsPool
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for FsPool
[src]
impl Default for FsPool
impl Debug for FsPool
[src]
impl Debug for FsPool