pub struct SuffixArray<'a> { /* private fields */ }
Expand description
Suffix array for byte string.
Implementations§
Source§impl<'a> SuffixArray<'a>
impl<'a> SuffixArray<'a>
pub fn new(s: &'a [u8]) -> Self
pub fn set(&mut self, s: &'a [u8])
pub fn fit(&mut self)
Sourcepub fn into_parts(self) -> (&'a [u8], Vec<u32>)
pub fn into_parts(self) -> (&'a [u8], Vec<u32>)
Take out the suffix array and its corresponding byte string.
Sourcepub fn from_parts(s: &'a [u8], sa: Vec<u32>) -> Option<Self>
pub fn from_parts(s: &'a [u8], sa: Vec<u32>) -> Option<Self>
Compose existed suffix array and its corresponding byte string together, and checks the integrity.
Sourcepub unsafe fn unchecked_from_parts(s: &'a [u8], sa: Vec<u32>) -> Self
pub unsafe fn unchecked_from_parts(s: &'a [u8], sa: Vec<u32>) -> Self
Compose existed suffix array and its corresponding byte string together without integrity check.
Sourcepub fn enable_buckets(&mut self)
pub fn enable_buckets(&mut self)
Enable bucket pointers to speed up large amount of pattern searching.
The overhead is about 257 KiB.
Sourcepub fn search_all(&self, pat: &[u8]) -> &[u32]
pub fn search_all(&self, pat: &[u8]) -> &[u32]
Search for all the unsorted occurrence of given pattern (can overlap).
Sourcepub fn search_lcp(&self, pat: &[u8]) -> Range<usize>
pub fn search_lcp(&self, pat: &[u8]) -> Range<usize>
Search for a sub-string that has the longest common prefix of the given pattern.
Trait Implementations§
Source§impl<'a> AsRef<[u8]> for SuffixArray<'a>
impl<'a> AsRef<[u8]> for SuffixArray<'a>
Source§impl<'a> Clone for SuffixArray<'a>
impl<'a> Clone for SuffixArray<'a>
Source§fn clone(&self) -> SuffixArray<'a>
fn clone(&self) -> SuffixArray<'a>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<'a> Freeze for SuffixArray<'a>
impl<'a> RefUnwindSafe for SuffixArray<'a>
impl<'a> Send for SuffixArray<'a>
impl<'a> Sync for SuffixArray<'a>
impl<'a> Unpin for SuffixArray<'a>
impl<'a> UnwindSafe for SuffixArray<'a>
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
Mutably borrows from an owned value. Read more