Snapshot

Struct Snapshot 

Source
pub struct Snapshot<T: Sync + Send + 'static> { /* private fields */ }
Expand description

A representation of the results of a Nucleo worker after finishing a tick.

Implementations§

Source§

impl<T: Sync + Send + 'static> Snapshot<T>

Source

pub fn item_count(&self) -> u32

Returns that total number of items

Source

pub fn pattern(&self) -> &MultiPattern

Returns the pattern which items were matched against

Source

pub fn matched_item_count(&self) -> u32

Returns that number of items that matched the pattern

Source

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

Source

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

Source

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.

Source

pub fn matches(&self) -> &[Match]

Returns the matches corresponding to this snapshot.

Source

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.

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> 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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.