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

Required methods

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

The current number of bytes this FileContents describes.

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

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.

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().

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.

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().

Implementors