Struct tantivy::directory::FileSlice[][src]

pub struct FileSlice { /* fields omitted */ }

Logical slice of read only file in tantivy. It can be cloned and sliced cheaply.

Implementations

impl FileSlice[src]

pub fn new(file_handle: Box<dyn FileHandle>) -> Self[src]

Wraps a FileHandle.

pub fn slice(&self, from: usize, to: usize) -> FileSlice[src]

Creates a fileslice that is just a view over a slice of the data.

Panics

Panics if to < from or if to exceeds the filesize.

pub fn empty() -> FileSlice[src]

Creates an empty FileSlice

pub fn read_bytes(&self) -> Result<OwnedBytes>[src]

Returns a OwnedBytes with all of the data in the FileSlice.

The behavior is strongly dependant on the implementation of the underlying Directory and the FileSliceTrait it creates. In particular, it is up to the Directory implementation to handle caching if needed.

pub fn read_bytes_slice(&self, from: usize, to: usize) -> Result<OwnedBytes>[src]

Reads a specific slice of data.

This is equivalent to running file_slice.slice(from, to).read_bytes().

pub fn split(self, left_len: usize) -> (FileSlice, FileSlice)[src]

Splits the FileSlice at the given offset and return two file slices. file_slice[..split_offset] and file_slice[split_offset..].

This operation is cheap and must not copy any underlying data.

pub fn split_from_end(self, right_len: usize) -> (FileSlice, FileSlice)[src]

Splits the file slice at the given offset and return two file slices. file_slice[..split_offset] and file_slice[split_offset..].

pub fn slice_from(&self, from_offset: usize) -> FileSlice[src]

Like .slice(...) but enforcing only the from boundary.

Equivalent to .slice(from_offset, self.len())

pub fn slice_to(&self, to_offset: usize) -> FileSlice[src]

Like .slice(...) but enforcing only the to boundary.

Equivalent to .slice(0, to_offset)

Trait Implementations

impl Clone for FileSlice[src]

impl FileHandle for FileSlice[src]

impl<B> From<B> for FileSlice where
    B: StableDeref + Deref<Target = [u8]> + 'static + Send + Sync
[src]

impl HasLen for FileSlice[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<T> Fruit for T where
    T: Send + Downcast
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,