pub struct FsPool { /* private fields */ }
Expand description
A pool of threads to handle file IO.
Implementations§
source§impl FsPool
impl FsPool
sourcepub fn with_executor<E>(executor: E) -> Selfwhere
E: Executor<Box<dyn Future<Item = (), Error = ()> + Send>> + Send + Sync + 'static,
pub fn with_executor<E>(executor: E) -> Selfwhere 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.
sourcepub fn read<P>(&self, path: P, opts: ReadOptions) -> FsReadStreamwhere
P: AsRef<Path> + Send + 'static,
pub fn read<P>(&self, path: P, opts: ReadOptions) -> FsReadStreamwhere P: AsRef<Path> + Send + 'static,
Returns a Stream
of the contents of the file at the supplied path.
sourcepub fn read_file(&self, file: File, opts: ReadOptions) -> FsReadStream
pub fn read_file(&self, file: File, opts: ReadOptions) -> FsReadStream
Returns a Stream
of the contents of the supplied file.
sourcepub fn write<P>(&self, path: P, opts: WriteOptions) -> FsWriteSinkwhere
P: AsRef<Path> + Send + 'static,
pub fn write<P>(&self, path: P, opts: WriteOptions) -> FsWriteSinkwhere P: AsRef<Path> + Send + 'static,
Returns a Sink
to send bytes to be written to the file at the supplied path.
sourcepub fn write_file(&self, file: File) -> FsWriteSink
pub fn write_file(&self, file: File) -> FsWriteSink
Returns a Sink
to send bytes to be written to the supplied file.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for FsPool
impl Send for FsPool
impl Sync for FsPool
impl Unpin for FsPool
impl !UnwindSafe for FsPool
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more