[][src]Struct tantivy::directory::ReadOnlySource

pub struct ReadOnlySource { /* fields omitted */ }

Read object that represents files in tantivy.

These read objects are only in charge to deliver the data in the form of a constant read-only &[u8]. Whatever happens to the directory file, the data hold by this object should never be altered or destroyed.

Methods

impl ReadOnlySource[src]

pub fn empty() -> ReadOnlySource[src]

Creates an empty ReadOnlySource

pub fn as_slice(&self) -> &[u8][src]

Returns the data underlying the ReadOnlySource object.

pub fn split(self, addr: usize) -> (ReadOnlySource, ReadOnlySource)[src]

Splits into 2 ReadOnlySource, at the offset given as an argument.

pub fn slice(&self, start: usize, stop: usize) -> ReadOnlySource[src]

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

Keep in mind that any living slice extends the lifetime of the original ReadOnlySource,

For instance, if ReadOnlySource wraps 500MB worth of data in anonymous memory, and only a 1KB slice is remaining, the whole 500MBs are retained in memory.

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

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

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

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

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

Equivalent to .slice(0, to_offset)

Trait Implementations

impl HasLen for ReadOnlySource[src]

impl From<Arc<Box<dyn Deref<Target = [u8]> + 'static + Sync + Send>>> for ReadOnlySource[src]

impl From<Vec<u8>> for ReadOnlySource[src]

impl Clone for ReadOnlySource[src]

impl Deref for ReadOnlySource[src]

type Target = [u8]

The resulting type after dereferencing.

impl StableDeref for ReadOnlySource[src]

impl CloneStableDeref for ReadOnlySource[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Erased for T[src]

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

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