FileApi

Trait FileApi 

Source
pub trait FileApi {
    type File;

    // Required methods
    fn open(&mut self, filename: &Path) -> Option<Self::File>;
    fn read(file: &mut Self::File, buf: &mut [u8]) -> bool;
    fn seek(file: &mut Self::File, pos: SeekFrom) -> bool;
    fn tell(file: &mut Self::File) -> Option<u64>;
}
Expand description

The file reading API

Application can provide its own File API to override default. For example, this may be useful in cases when soundfonts isn’t located in the file system.

Required Associated Types§

Source

type File

The type for file descriptor

Required Methods§

Source

fn open(&mut self, filename: &Path) -> Option<Self::File>

Open file with specified name

Source

fn read(file: &mut Self::File, buf: &mut [u8]) -> bool

Read binary data from file descriptor

Source

fn seek(file: &mut Self::File, pos: SeekFrom) -> bool

Seek current reading position

Source

fn tell(file: &mut Self::File) -> Option<u64>

Get current reading position from beginning of file

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§