pub struct File { /* private fields */ }
Available on crate feature
tokio
only.Expand description
Wrapper around tokio::fs::File
which adds more helpful
information to all errors.
Implementations§
source§impl File
impl File
sourcepub async fn create(path: impl Into<PathBuf>) -> Result<File>
pub async fn create(path: impl Into<PathBuf>) -> Result<File>
Wrapper for tokio::fs::File::create
.
sourcepub fn from_std(std: File) -> File
pub fn from_std(std: File) -> File
Wrapper for tokio::fs::File::from_std
.
sourcepub async fn sync_all(&self) -> Result<()>
pub async fn sync_all(&self) -> Result<()>
Wrapper for tokio::fs::File::sync_all
.
sourcepub async fn sync_data(&self) -> Result<()>
pub async fn sync_data(&self) -> Result<()>
Wrapper for tokio::fs::File::sync_data
.
sourcepub async fn metadata(&self) -> Result<Metadata>
pub async fn metadata(&self) -> Result<Metadata>
Wrapper for tokio::fs::File::metadata
.
sourcepub async fn try_clone(&self) -> Result<File>
pub async fn try_clone(&self) -> Result<File>
Wrapper for tokio::fs::File::try_clone
.
sourcepub async fn into_std(self) -> File ⓘ
pub async fn into_std(self) -> File ⓘ
Wrapper for tokio::fs::File::into_std
.
sourcepub fn try_into_std(self) -> Result<File, File>
pub fn try_into_std(self) -> Result<File, File>
Wrapper for tokio::fs::File::try_into_std
.
sourcepub async fn set_permissions(&self, perm: Permissions) -> Result<()>
pub async fn set_permissions(&self, perm: Permissions) -> Result<()>
Wrapper for tokio::fs::File::set_permissions
.
source§impl File
impl File
Methods added by fs-err that are not available on
tokio::fs::File
.
sourcepub fn from_parts<P>(file: TokioFile, path: P) -> Self
pub fn from_parts<P>(file: TokioFile, path: P) -> Self
Creates a File
from a raw file and its path.
sourcepub fn into_parts(self) -> (TokioFile, PathBuf)
pub fn into_parts(self) -> (TokioFile, PathBuf)
Extract the raw file and its path from this File
.
sourcepub fn file(&self) -> &TokioFile
pub fn file(&self) -> &TokioFile
Returns a reference to the underlying tokio::fs::File
.
sourcepub fn file_mut(&mut self) -> &mut TokioFile
pub fn file_mut(&mut self) -> &mut TokioFile
Returns a mutable reference to the underlying tokio::fs::File
.
Trait Implementations§
source§impl AsyncWrite for File
impl AsyncWrite for File
source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8]
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8] ) -> Poll<Result<usize>>
Attempt to write bytes from
buf
into the object. Read moresource§fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Attempts to flush the object, ensuring that any buffered data reach
their destination. Read more
source§fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Initiates or attempts to shut down this writer, returning success when
the I/O connection has completely shut down. Read more
source§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>]
) -> Poll<Result<usize>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>] ) -> Poll<Result<usize>>
Like
poll_write
, except that it writes from a slice of buffers. Read moresource§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
Determines if this writer has an efficient
poll_write_vectored
implementation. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl !UnwindSafe for File
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