[−][src]Struct fs::FsPool
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]
E: Executor<Box<dyn 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]
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]
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]
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]
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]
P: AsRef<Path> + Send + 'static,
Returns a Future
that resolves when the target file is deleted.
Trait Implementations
impl Clone for FsPool
[src]
fn clone(&self) -> 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
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,