pub struct IoPool { /* private fields */ }Expand description
Thread pool for handling file I/O operations.
This allows the main event loop to remain responsive while files are being read from disk.
Implementations§
Source§impl IoPool
impl IoPool
Sourcepub fn new(num_workers: usize) -> Self
pub fn new(num_workers: usize) -> Self
Create a new IO pool with the specified number of worker threads.
Sourcepub fn request_file(&self, file: TextFile)
pub fn request_file(&self, file: TextFile)
Request a file to be read.
The result will be available via receiver().
Sourcepub fn receiver(&self) -> &Receiver<IoResponse>
pub fn receiver(&self) -> &Receiver<IoResponse>
Get the receiver for file read responses.
Use this with crossbeam_channel::select! to wait for responses.
Auto Trait Implementations§
impl Freeze for IoPool
impl !RefUnwindSafe for IoPool
impl Send for IoPool
impl Sync for IoPool
impl Unpin for IoPool
impl !UnwindSafe for IoPool
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