[][src]Struct wasi_common::fs::File

pub struct File<'ctx> { /* fields omitted */ }

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.

Methods

impl<'ctx> File<'ctx>[src]

pub unsafe fn from_raw_wasi_fd(ctx: &'ctx mut WasiCtx, fd: __wasi_fd_t) -> 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.

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.