pub struct Snapshot<T> { /* 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 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.
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_detached_item(&self, index: u32) -> Option<DetachedItem<T>>
pub fn get_detached_item(&self, index: u32) -> Option<DetachedItem<T>>
Returns the detached item at the given index.
Sourcepub unsafe fn get_detached_item_unchecked(&self, index: u32) -> DetachedItem<T>
pub unsafe fn get_detached_item_unchecked(&self, index: u32) -> DetachedItem<T>
Returns the detached item at the given index without checking that the index is valid.
§Safety
Item at index must be initialized. That means you must have observed
push returning this value or get returning Some for this value.
Just because a later index is initialized doesn’t mean that this index
is initialized
Sourcepub fn get_matched_item(&self, n: u32) -> Option<Item<'_, T>>
pub fn get_matched_item(&self, n: u32) -> Option<Item<'_, T>>
A convenience function to return the Item corresponding to the
nth match.
Returns None if n is greater than or equal to the match count.
Sourcepub fn get_matched_detached_item(&self, n: u32) -> Option<DetachedItem<T>>
pub fn get_matched_detached_item(&self, n: u32) -> Option<DetachedItem<T>>
A convenience function to return the DetachedItem corresponding to the
nth match.
Returns None if n is greater than or equal to the match count.
Auto Trait Implementations§
impl<T> Freeze for Snapshot<T>
impl<T> RefUnwindSafe for Snapshot<T>where
T: RefUnwindSafe,
impl<T> Send for Snapshot<T>
impl<T> Sync for Snapshot<T>
impl<T> Unpin for Snapshot<T>
impl<T> UnsafeUnpin for Snapshot<T>
impl<T> UnwindSafe for Snapshot<T>where
T: RefUnwindSafe,
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