Struct aho_corasick::packed::teddy::generic::Fat

source ·
pub(crate) struct Fat<V, const BYTES: usize> {
    teddy: Teddy<16>,
    masks: [Mask<V>; BYTES],
}
Expand description

A “fat” Teddy implementation that is generic over both the vector type and the minimum length of the patterns being searched for.

Only 1, 2, 3 and 4 bytes are supported as minimum lengths.

Fields§

§teddy: Teddy<16>

A generic data structure for doing “fat” Teddy verification.

§masks: [Mask<V>; BYTES]

The masks used as inputs to the shuffle operation to generate candidates (which are fed into the verification routines).

Implementations§

source§

impl<V: FatVector, const BYTES: usize> Fat<V, BYTES>

source

pub(crate) unsafe fn new(patterns: Arc<Patterns>) -> Fat<V, BYTES>

Create a new “fat” Teddy searcher for the given patterns.

§Panics

This panics when BYTES is any value other than 1, 2, 3 or 4.

§Safety

Callers must ensure that this is okay to call in the current target for the current CPU.

source

pub(crate) fn memory_usage(&self) -> usize

Returns the approximate total amount of heap used by this type, in units of bytes.

source

pub(crate) fn minimum_len(&self) -> usize

Returns the minimum length, in bytes, that a haystack must be in order to use it with this searcher.

source§

impl<V: FatVector> Fat<V, 1>

source

pub(crate) unsafe fn find( &self, start: *const u8, end: *const u8, ) -> Option<Match>

Look for an occurrences of the patterns in this finder in the haystack given by the start and end pointers.

If no match could be found, then None is returned.

§Safety

The given pointers representing the haystack must be valid to read from. They must also point to a region of memory that is at least the minimum length required by this searcher.

Callers must ensure that this is okay to call in the current target for the current CPU.

source

unsafe fn find_one(&self, cur: *const u8, end: *const u8) -> Option<Match>

Look for a match starting at the V::BYTES at and after cur. If there isn’t one, then None is returned.

§Safety

The given pointers representing the haystack must be valid to read from. They must also point to a region of memory that is at least the minimum length required by this searcher.

Callers must ensure that this is okay to call in the current target for the current CPU.

source

unsafe fn candidate(&self, cur: *const u8) -> V

Look for a candidate match (represented as a vector) starting at the V::BYTES at and after cur. If there isn’t one, then a vector with all bits set to zero is returned.

§Safety

The given pointer representing the haystack must be valid to read from.

Callers must ensure that this is okay to call in the current target for the current CPU.

source§

impl<V: FatVector> Fat<V, 2>

source

pub(crate) unsafe fn find( &self, start: *const u8, end: *const u8, ) -> Option<Match>

See Fat<V, 1>::find.

source

unsafe fn find_one( &self, cur: *const u8, end: *const u8, prev0: &mut V, ) -> Option<Match>

See Fat<V, 1>::find_one.

source

unsafe fn candidate(&self, cur: *const u8, prev0: &mut V) -> V

See Fat<V, 1>::candidate.

source§

impl<V: FatVector> Fat<V, 3>

source

pub(crate) unsafe fn find( &self, start: *const u8, end: *const u8, ) -> Option<Match>

See Fat<V, 1>::find.

source

unsafe fn find_one( &self, cur: *const u8, end: *const u8, prev0: &mut V, prev1: &mut V, ) -> Option<Match>

See Fat<V, 1>::find_one.

source

unsafe fn candidate(&self, cur: *const u8, prev0: &mut V, prev1: &mut V) -> V

See Fat<V, 1>::candidate.

source§

impl<V: FatVector> Fat<V, 4>

source

pub(crate) unsafe fn find( &self, start: *const u8, end: *const u8, ) -> Option<Match>

See Fat<V, 1>::find.

source

unsafe fn find_one( &self, cur: *const u8, end: *const u8, prev0: &mut V, prev1: &mut V, prev2: &mut V, ) -> Option<Match>

See Fat<V, 1>::find_one.

source

unsafe fn candidate( &self, cur: *const u8, prev0: &mut V, prev1: &mut V, prev2: &mut V, ) -> V

See Fat<V, 1>::candidate.

Trait Implementations§

source§

impl<V: Clone, const BYTES: usize> Clone for Fat<V, BYTES>

source§

fn clone(&self) -> Fat<V, BYTES>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<V: Debug, const BYTES: usize> Debug for Fat<V, BYTES>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<V, const BYTES: usize> Freeze for Fat<V, BYTES>
where V: Freeze,

§

impl<V, const BYTES: usize> RefUnwindSafe for Fat<V, BYTES>
where V: RefUnwindSafe,

§

impl<V, const BYTES: usize> Send for Fat<V, BYTES>
where V: Send,

§

impl<V, const BYTES: usize> Sync for Fat<V, BYTES>
where V: Sync,

§

impl<V, const BYTES: usize> Unpin for Fat<V, BYTES>
where V: Unpin,

§

impl<V, const BYTES: usize> UnwindSafe for Fat<V, BYTES>
where V: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.