pub struct File(/* private fields */);
Expand description
A wrapper around a std::fs::File that implements AsyncSliceReader and AsyncSliceWriter
Implementations§
Source§impl File
impl File
Sourcepub async fn create(
create_file: impl FnOnce() -> Result<File> + Send + 'static,
) -> Result<Self>
pub async fn create( create_file: impl FnOnce() -> Result<File> + Send + 'static, ) -> Result<Self>
Create a new File from a function that creates a std::fs::File
Sourcepub fn from_std(file: File) -> Self
pub fn from_std(file: File) -> Self
Create a new File from a std::fs::File
This is fine if you already have a std::fs::File and want to use it with File, but opening a file is a blocking op that you probably don’t want to do in an async context.
Trait Implementations§
Source§impl AsyncSliceReader for File
impl AsyncSliceReader for File
Source§impl AsyncSliceWriter for File
impl AsyncSliceWriter for File
Auto Trait Implementations§
impl Freeze for File
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> AsyncSliceReaderExt for Twhere
T: AsyncSliceReader,
impl<T> AsyncSliceReaderExt for Twhere
T: AsyncSliceReader,
Source§async fn read_to_end(&mut self) -> Result<Bytes>
async fn read_to_end(&mut self) -> Result<Bytes>
Read the entire resource into a bytes::Bytes buffer, if possible.
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