Skip to main content

TextSource

Trait TextSource 

Source
pub trait TextSource:
    Debug
    + Send
    + Sync {
    // Required methods
    fn len(&self) -> usize;
    fn bytes_at(&self, index: usize) -> Result<Option<&[u8]>>;
    fn footprint(&self) -> usize;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn bytes_len_at(&self, index: usize) -> Result<Option<usize>> { ... }
    fn equal(&self, other: &dyn TextSource) -> bool { ... }
}
Expand description

Random access to immutable text kept by a storage reader.

Required Methods§

Source

fn len(&self) -> usize

Number of values available.

Source

fn bytes_at(&self, index: usize) -> Result<Option<&[u8]>>

Bytes at one position, or no value when the position is outside the source.

Source

fn footprint(&self) -> usize

Resident bytes retained by this source.

Provided Methods§

Source

fn is_empty(&self) -> bool

Whether this source has no values.

Source

fn bytes_len_at(&self, index: usize) -> Result<Option<usize>>

Byte length at one position without requiring the payload when the source has an index.

Source

fn equal(&self, other: &dyn TextSource) -> bool

Whether another source presents the same values.

Trait Implementations§

Source§

impl PartialEq for dyn TextSource

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§