Skip to main content

FileHandle

Trait FileHandle 

Source
pub trait FileHandle:
    'static
    + Send
    + Sync
    + HasLen
    + Debug {
    // Required method
    fn read_bytes(&self, range: Range<usize>) -> Result<OwnedBytes>;
}
Expand description

Objects that represents files sections in tantivy.

By contract, whatever happens to the directory file, as long as a FileHandle is alive, the data associated with it cannot be altered or destroyed.

The underlying behavior is therefore specific to the Directory that created it. Despite its name, a FileSlice may or may not directly map to an actual file on the filesystem.

Required Methods§

Source

fn read_bytes(&self, range: Range<usize>) -> Result<OwnedBytes>

Reads a slice of bytes.

This method may panic if the range requested is invalid.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FileHandle for &'static [u8]

Implementors§