Trait bip_disk::FileSystem [] [src]

pub trait FileSystem {
    type File;
    fn open_file<P>(&self, path: P) -> Result<Self::File>
    where
        P: AsRef<Path> + Send + 'static
;
fn sync_file<P>(&self, path: P) -> Result<()>
    where
        P: AsRef<Path> + Send + 'static
;
fn file_size(&self, file: &Self::File) -> Result<u64>;
fn read_file(
        &self,
        file: &mut Self::File,
        offset: u64,
        buffer: &mut [u8]
    ) -> Result<usize>;
fn write_file(
        &self,
        file: &mut Self::File,
        offset: u64,
        buffer: &[u8]
    ) -> Result<usize>; }

Trait for performing operations on some file system.

Relative paths will originate from an implementation defined directory.

Associated Types

Some file object.

Required Methods

Open a file, create it if it does not exist.

Intermediate directories will be created if necessary.

Sync the file.

Get the size of the file in bytes.

Read the contents of the file at the given offset.

On success, return the number of bytes read.

Write the contents of the file at the given offset.

On success, return the number of bytes written. If offset is past the current size of the file, zeroes will be filled in.

Implementations on Foreign Types

impl<'a, F> FileSystem for &'a F where
    F: FileSystem
[src]

[src]

[src]

[src]

[src]

[src]

Implementors