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>
impl<V: FatVector, const BYTES: usize> Fat<V, BYTES>
sourcepub(crate) fn memory_usage(&self) -> usize
pub(crate) fn memory_usage(&self) -> usize
Returns the approximate total amount of heap used by this type, in units of bytes.
sourcepub(crate) fn minimum_len(&self) -> usize
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>
impl<V: FatVector> Fat<V, 1>
sourcepub(crate) unsafe fn find(
&self,
start: *const u8,
end: *const u8,
) -> Option<Match>
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.
sourceunsafe fn find_one(&self, cur: *const u8, end: *const u8) -> Option<Match>
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.
sourceunsafe fn candidate(&self, cur: *const u8) -> V
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>
impl<V: FatVector> Fat<V, 2>
source§impl<V: FatVector> Fat<V, 3>
impl<V: FatVector> Fat<V, 3>
source§impl<V: FatVector> Fat<V, 4>
impl<V: FatVector> Fat<V, 4>
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)