[−][src]Struct wasi_common::fs::File
A reference to an open file on the filesystem.
This corresponds to std::fs::File
.
Note that this File
has no open
or create
methods. To open or create
a file, you must first obtain a Dir
containing the file, and then call
Dir::open_file
or Dir::create_file
.
Implementations
impl<'ctx> File<'ctx>
[src]
pub unsafe fn from_raw_wasi_fd(ctx: &'ctx WasiCtx, fd: Fd) -> Self
[src]
Constructs a new instance of Self
from the given raw WASI file descriptor.
This corresponds to std::fs::File::from_raw_fd
.
pub fn sync_all(&self) -> Result<()>
[src]
Attempts to sync all OS-internal metadata to disk.
This corresponds to std::fs::File::sync_all
.
pub fn sync_data(&self) -> Result<()>
[src]
This function is similar to sync_all
, except that it may not synchronize
file metadata to the filesystem.
This corresponds to std::fs::File::sync_data
.
pub fn set_len(&self, size: u64) -> Result<()>
[src]
Truncates or extends the underlying file, updating the size of this file to become size.
This corresponds to std::fs::File::set_len
.
pub fn metadata(&self) -> Result<Metadata>
[src]
Queries metadata about the underlying file.
This corresponds to std::fs::File::metadata
.
Trait Implementations
impl<'ctx> Drop for File<'ctx>
[src]
impl<'ctx> Read for File<'ctx>
[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
[src]
TODO: Not yet implemented. See the comment in Dir::open_file
.
fn read_vectored(&mut self, bufs: &mut [IoSliceMut]) -> Result<usize, Error>
1.36.0[src]
fn is_read_vectored(&self) -> bool
[src]
unsafe fn initializer(&self) -> Initializer
[src]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
1.0.0[src]
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
1.0.0[src]
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
1.6.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
fn bytes(self) -> Bytes<Self>
1.0.0[src]
fn chain<R>(self, next: R) -> Chain<Self, R> where
R: Read,
1.0.0[src]
R: Read,
fn take(self, limit: u64) -> Take<Self>
1.0.0[src]
Auto Trait Implementations
impl<'ctx> !RefUnwindSafe for File<'ctx>
impl<'ctx> !Send for File<'ctx>
impl<'ctx> !Sync for File<'ctx>
impl<'ctx> Unpin for File<'ctx>
impl<'ctx> !UnwindSafe for File<'ctx>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointee for T
[src]
type Pointer = u32
fn debug(
pointer: <T as Pointee>::Pointer,
f: &mut Formatter
) -> Result<(), Error>
[src]
pointer: <T as Pointee>::Pointer,
f: &mut Formatter
) -> Result<(), Error>
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,