pub struct Snapshot<T: Sync + Send + 'static> { /* private fields */ }Implementations§
Source§impl<T: Sync + Send + 'static> Snapshot<T>
impl<T: Sync + Send + 'static> Snapshot<T>
Sourcepub fn item_count(&self) -> u32
pub fn item_count(&self) -> u32
Returns that total number of items
Sourcepub fn pattern(&self) -> &MultiPattern
pub fn pattern(&self) -> &MultiPattern
Returns the pattern which items were matched against
Sourcepub fn matched_item_count(&self) -> u32
pub fn matched_item_count(&self) -> u32
Returns that number of items that matched the pattern
Sourcepub fn matched_items(
&self,
range: impl RangeBounds<u32>,
) -> impl ExactSizeIterator<Item = Item<'_, T>> + DoubleEndedIterator + '_
pub fn matched_items( &self, range: impl RangeBounds<u32>, ) -> impl ExactSizeIterator<Item = Item<'_, T>> + DoubleEndedIterator + '_
Returns an iterator over the items that correspond to a subrange of all the matches in this snapshot.
§Panics
Panics if range has a range bound that is larger than
the matched item count
Sourcepub unsafe fn get_item_unchecked(&self, index: u32) -> Item<'_, T>
pub unsafe fn get_item_unchecked(&self, index: u32) -> Item<'_, T>
Returns a reference to the item at the given index.
§Safety
Item at index must be initialized. That means you must have observed a
match with the corresponding index in this exact snapshot. Observing
a higher index is not enough as item indices can be non-contigously
initialized
Sourcepub fn get_item(&self, index: u32) -> Option<Item<'_, T>>
pub fn get_item(&self, index: u32) -> Option<Item<'_, T>>
Returns a reference to the item at the given index.
Returns None if the given index is not initialized. This function
is only guarteed to return Some for item indices that can be found in
the matches of this struct. Both smaller and larger indices may return
None.
Auto Trait Implementations§
impl<T> Freeze for Snapshot<T>
impl<T> RefUnwindSafe for Snapshot<T>
impl<T> Send for Snapshot<T>
impl<T> Sync for Snapshot<T>
impl<T> Unpin for Snapshot<T>
impl<T> UnwindSafe for Snapshot<T>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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