pub struct File<D: Drive = DemoDriver<'static>> { /* private fields */ }Expand description
A file handle that runs on io-uring
Implementations§
Source§impl<D: Drive> File<D>
impl<D: Drive> File<D>
Sourcepub fn run_on_driver(file: File, driver: D) -> File<D>
pub fn run_on_driver(file: File, driver: D) -> File<D>
Take an existing file and run its IO on an io-uring driver
Sourcepub fn read_buffered(&self) -> &[u8] ⓘ
pub fn read_buffered(&self) -> &[u8] ⓘ
Access any data that has been read into the buffer, but not consumed
This is similar to the fill_buf method from AsyncBufRead, but instead of performing IO if the buffer is empty, it will just return an empty slice. This method can be used to copy out any left over buffered data before closing or performing a write.
Trait Implementations§
Source§impl<D: Drive> AsyncBufRead for File<D>
impl<D: Drive> AsyncBufRead for File<D>
Source§impl<D: Drive> AsyncRead for File<D>
impl<D: Drive> AsyncRead for File<D>
Source§impl<D: Drive> AsyncWrite for File<D>
impl<D: Drive> AsyncWrite for File<D>
Source§fn poll_write(
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
slice: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, ctx: &mut Context<'_>, slice: &[u8], ) -> Poll<Result<usize>>
Attempt to write bytes from
buf into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll<Result<()>>
Attempt to flush the object, ensuring that any buffered data reach
their destination. Read more
Auto Trait Implementations§
impl<D> Freeze for File<D>where
D: Freeze,
impl<D = DemoDriver<'static>> !RefUnwindSafe for File<D>
impl<D> Send for File<D>where
D: Send,
impl<D> Sync for File<D>where
D: Sync,
impl<D> Unpin for File<D>where
D: Unpin,
impl<D = DemoDriver<'static>> !UnwindSafe for File<D>
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