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) -> Self
pub fn with_executor<E>(executor: E) -> Self
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) -> FsReadStream
pub fn read<P>(&self, path: P, opts: ReadOptions) -> FsReadStream
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) -> FsWriteSink
pub fn write<P>(&self, path: P, opts: WriteOptions) -> FsWriteSink
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 Freeze for FsPool
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