Struct Events

Source
pub struct Events { /* private fields */ }
Expand description

Descending sorted collection of events

Implementations§

Source§

impl Events

Source

pub fn new(filter: &Filter) -> Self

New collection

Source

pub fn len(&self) -> usize

Returns the number of events in the collection.

Source

pub fn is_empty(&self) -> bool

Checks if there are no events.

Source

pub fn contains(&self, event: &Event) -> bool

Check if contains Event

Source

pub fn insert(&mut self, event: Event) -> bool

Insert Event

If the set did not previously contain an equal value, true is returned. If the collection is full, the older events will be discarded. Use Events::force_insert to always make sure the event is inserted.

Source

pub fn force_insert(&mut self, event: Event) -> bool

Force insert Event

Use Events::insert to respect the max collection capacity (if any). If the collection capacity is full, this method will increase it.

Source

pub fn extend<I>(&mut self, events: I)
where I: IntoIterator<Item = Event>,

Insert events

Source

pub fn merge(self, other: Self) -> Self

Merge events collections into a single one.

Collection is converted to unbounded if one of the merge Events have a different hash. In other words, the filters limit is respected only if the Events are related to the same list of filters.

Source

pub fn first(&self) -> Option<&Event>

Get first Event (descending order)

Source

pub fn first_owned(self) -> Option<Event>

Get first Event (descending order)

Source

pub fn last(&self) -> Option<&Event>

Get last Event (descending order)

Source

pub fn last_owned(self) -> Option<Event>

Get last Event (descending order)

Source

pub fn iter(&self) -> impl Iterator<Item = &Event>

Iterate events in descending order

Source

pub fn to_vec(self) -> Vec<Event>

Convert the collection to vector of events.

Trait Implementations§

Source§

impl Clone for Events

Source§

fn clone(&self) -> Events

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Events

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Events

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl FromIterator<Event> for Events

Source§

fn from_iter<T>(iter: T) -> Self
where T: IntoIterator<Item = Event>,

Creates a value from an iterator. Read more
Source§

impl IntoIterator for Events

Source§

type Item = Event

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<<Events as IntoIterator>::Item>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for Events

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Events

Auto Trait Implementations§

§

impl Freeze for Events

§

impl RefUnwindSafe for Events

§

impl Send for Events

§

impl Sync for Events

§

impl Unpin for Events

§

impl UnwindSafe for Events

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,