pub struct AsyncFile { /* private fields */ }Expand description
High-level async file handle
Provides async read/write operations with automatic statistics tracking.
Implementations§
Source§impl AsyncFile
impl AsyncFile
Sourcepub async fn open<P: AsRef<Path>>(path: P, io: Arc<AsyncIo>) -> Result<Self>
pub async fn open<P: AsRef<Path>>(path: P, io: Arc<AsyncIo>) -> Result<Self>
Open a file for reading and writing (creates if not exists)
Sourcepub async fn open_read<P: AsRef<Path>>(
path: P,
io: Arc<AsyncIo>,
) -> Result<Self>
pub async fn open_read<P: AsRef<Path>>( path: P, io: Arc<AsyncIo>, ) -> Result<Self>
Open a file read-only
Sourcepub async fn read_at(&self, offset: u64, len: usize) -> Result<Bytes>
pub async fn read_at(&self, offset: u64, len: usize) -> Result<Bytes>
Async read at a specific offset
Sourcepub async fn write_at(&self, offset: u64, data: &[u8]) -> Result<usize>
pub async fn write_at(&self, offset: u64, data: &[u8]) -> Result<usize>
Async write at a specific offset
Sourcepub async fn read(&self, len: usize) -> Result<Bytes>
pub async fn read(&self, len: usize) -> Result<Bytes>
Async read at current position (updates position)
Auto Trait Implementations§
impl !Freeze for AsyncFile
impl !RefUnwindSafe for AsyncFile
impl Send for AsyncFile
impl Sync for AsyncFile
impl Unpin for AsyncFile
impl !UnwindSafe for AsyncFile
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more