Skip to main content

Trie

Struct Trie 

Source
pub struct Trie<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Trie<'a>

Source

pub const DEFAULT_PREFETCH_LANES: usize = 4

Number of independent walks Trie::common_prefix_batch keeps in flight.

Source

pub const MAX_PREFETCH_LANES: usize = 16

Upper bound on lanes so the scheduler can keep lane state on the stack.

Source

pub fn from_bytes(data: &'a [u8]) -> Trie<'a>

Source

pub fn new(data: &'a [u8], size: usize) -> Trie<'a>

Source

pub fn new_owned(data: Vec<u32>) -> Trie<'a>

Source

pub fn total_size(&self) -> usize

Source

pub fn common_prefix_iterator<'b>( &'a self, input: &'b [u8], offset: usize, ) -> TrieEntryIter<'b> ⓘ
where 'a: 'b,

Source

pub fn common_prefix_batch<F: FnMut(usize, u32, usize)>( &self, input: &[u8], starts: &[usize], emit: F, )

Run common-prefix search from many start positions, overlapping their memory latency.

emit(bucket, value, end) fires once per match; bucket indexes starts. Within a bucket, matches keep Trie::common_prefix_iterator order, so grouping by bucket reproduces the scalar result.

Source

pub fn common_prefix_batch_cfg<F: FnMut(usize, u32, usize)>( &self, input: &[u8], starts: &[usize], lanes: usize, prefetch: bool, emit: F, )

Trie::common_prefix_batch with an explicit lane count and prefetch toggle. lanes is rounded to the nearest compile-time-specialized count; values above Trie::MAX_PREFETCH_LANES are clamped.

Auto Trait Implementations§

§

impl<'a> Freeze for Trie<'a>

§

impl<'a> RefUnwindSafe for Trie<'a>

§

impl<'a> Send for Trie<'a>

§

impl<'a> Sync for Trie<'a>

§

impl<'a> Unpin for Trie<'a>

§

impl<'a> UnsafeUnpin for Trie<'a>

§

impl<'a> UnwindSafe for Trie<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.