Struct photonio_uring::fs::File
source · pub struct File(_);
Expand description
A reference to an open file.
This type is an async version of std::fs::File
.
Implementations
sourceimpl File
impl File
sourcepub async fn open<P: AsRef<Path>>(path: P) -> Result<Self>
pub async fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Opens a file in read-only mode.
See also std::fs::File::open
.
sourcepub async fn create<P: AsRef<Path>>(path: P) -> Result<Self>
pub async fn create<P: AsRef<Path>>(path: P) -> Result<Self>
Opens a file in write-only mode.
This function will create a file if it does not exist, and will truncate it if it does.
See also std::fs::File::create
.
sourcepub async fn metadata(&self) -> Result<Metadata>
pub async fn metadata(&self) -> Result<Metadata>
Returns the metadata about this file.
See also std::fs::File::metadata
.
sourcepub async fn set_len(&self, size: u64) -> Result<()>
pub async fn set_len(&self, size: u64) -> Result<()>
Truncates or extends the size of this file.
See also std::fs::File::set_len
.
sourcepub async fn sync_all(&self) -> Result<()>
pub async fn sync_all(&self) -> Result<()>
Synchronizes all modified data of this file to disk.
See also std::fs::File::sync_all
.
sourcepub async fn sync_data(&self) -> Result<()>
pub async fn sync_data(&self) -> Result<()>
This function is similiar to Self::sync_all
, except that it might
not synchronize metadata.
See also std::fs::File::sync_data
.
Trait Implementations
sourceimpl FromRawFd for File
impl FromRawFd for File
sourceunsafe fn from_raw_fd(fd: RawFd) -> Self
unsafe fn from_raw_fd(fd: RawFd) -> Self
Constructs a new instance of
Self
from the given raw file
descriptor. 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ReadAtExt for Twhere
T: ReadAt,
impl<T> ReadAtExt for Twhere
T: ReadAt,
type ReadExactAt = impl Future<Output = Result<(), Error>> + 'a
type ReadExactAt = impl Future<Output = Result<(), Error>> + 'a
A future that resolves to the result of
Self::read_exact_at
.sourcefn read_exact_at<'a>(
&'a self,
buf: &'a mut [u8],
pos: u64
) -> <T as ReadAtExt>::ReadExactAt<'a>
fn read_exact_at<'a>(
&'a self,
buf: &'a mut [u8],
pos: u64
) -> <T as ReadAtExt>::ReadExactAt<'a>
Reads the exact number of bytes from this object at
pos
to fill buf
.sourceimpl<T> WriteAtExt for Twhere
T: WriteAt,
impl<T> WriteAtExt for Twhere
T: WriteAt,
type WriteAllAt = impl Future<Output = Result<(), Error>> + 'a
type WriteAllAt = impl Future<Output = Result<(), Error>> + 'a
A future that resolves to the result of
Self::write_all_at
.sourcefn write_all_at<'a>(
&'a self,
buf: &'a [u8],
pos: u64
) -> <T as WriteAtExt>::WriteAllAt<'a>
fn write_all_at<'a>(
&'a self,
buf: &'a [u8],
pos: u64
) -> <T as WriteAtExt>::WriteAllAt<'a>
Writes all bytes from
buf
into this object at pos
.