[][src]Trait wasi_common::virtfs::FileContents

pub trait FileContents {
    pub fn max_size(&self) -> Filesize;
pub fn size(&self) -> Filesize;
pub fn resize(&mut self, new_size: Filesize) -> Result<()>;
pub fn pwritev(
        &mut self,
        iovs: &[IoSlice<'_>],
        offset: Filesize
    ) -> Result<usize>;
pub fn preadv(
        &self,
        iovs: &mut [IoSliceMut<'_>],
        offset: Filesize
    ) -> Result<usize>;
pub fn pwrite(&mut self, buf: &[u8], offset: Filesize) -> Result<usize>;
pub fn pread(&self, buf: &mut [u8], offset: Filesize) -> Result<usize>; }

Required methods

pub fn max_size(&self) -> Filesize[src]

The implementation-defined maximum size of the store corresponding to a FileContents implementation.

pub fn size(&self) -> Filesize[src]

The current number of bytes this FileContents describes.

pub fn resize(&mut self, new_size: Filesize) -> Result<()>[src]

Resize to hold new_size number of bytes, or error if this is not possible.

pub fn pwritev(
    &mut self,
    iovs: &[IoSlice<'_>],
    offset: Filesize
) -> Result<usize>
[src]

Write a list of IoSlice starting at offset. offset plus the total size of all iovs is guaranteed to not exceed max_size. Implementations must not indicate more bytes have been written than can be held by iovs.

pub fn preadv(
    &self,
    iovs: &mut [IoSliceMut<'_>],
    offset: Filesize
) -> Result<usize>
[src]

Read from the file from offset, filling a list of IoSlice. The returend size must not be more than the capactiy of iovs, and must not exceed the limit reported by self.max_size().

pub fn pwrite(&mut self, buf: &[u8], offset: Filesize) -> Result<usize>[src]

Write contents from buf to this file starting at offset. offset plus the length of buf is guaranteed to not exceed max_size. Implementations must not indicate more bytes have been written than the size of buf.

pub fn pread(&self, buf: &mut [u8], offset: Filesize) -> Result<usize>[src]

Read from the file at offset, filling buf. The returned size must not be more than the capacity of buf, and offset plus the returned size must not exceed self.max_size().

Loading content...

Implementors

impl FileContents for VecFileContents[src]

Loading content...