Struct mergable::Counter

source ·
pub struct Counter<V, Seq> { /* private fields */ }
Expand description

A counter.

Implementations§

source§

impl<V, SF: SequenceFactory> Counter<V, Sequence<SF>>

source

pub fn new(ctx: &mut Context<SF>, value: V) -> Selfwhere V: Clone,

source

pub fn add(&mut self, ctx: &mut Context<SF>, value: V)where V: for<'a> AddAssign<&'a V> + AddAssign<V>,

Set this session’s value

This will overwrite any existing values.

source

pub fn total(&self) -> &V

Trait Implementations§

source§

impl<V: Clone, Seq: Clone> Clone for Counter<V, Seq>

source§

fn clone(&self) -> Counter<V, Seq>

Returns a copy 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<V: Debug, Seq: Debug> Debug for Counter<V, Seq>

source§

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

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

impl<V: Default, SF: SequenceFactory> Default for Counter<V, Sequence<SF>>

source§

fn default() -> Self

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

impl<V: Clone + for<'a> AddAssign<&'a V> + for<'a> SubAssign<&'a V>, SF: SequenceFactory> Mergable for Counter<V, Sequence<SF>>

§

type Diff = CounterDiff<V, Sequence<SF>>

§

type Seq = Sequence<SF>

source§

fn diff(&self, that: &Self) -> Self::Diff

Produce a diff. Read more
source§

fn apply(&mut self, diff: Self::Diff) -> Result<(), ApplyError>

source§

fn clean(&mut self, cutoff: &Self::Seq)

Clean up history. Read more
source§

fn merge(&mut self, other: Self)

source§

impl<V: PartialEq, Seq> PartialEq<Counter<V, Seq>> for Counter<V, Seq>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<V, Seq> RefUnwindSafe for Counter<V, Seq>where Seq: RefUnwindSafe, V: RefUnwindSafe,

§

impl<V, Seq> Send for Counter<V, Seq>where Seq: Send, V: Send,

§

impl<V, Seq> Sync for Counter<V, Seq>where Seq: Sync, V: Sync,

§

impl<V, Seq> Unpin for Counter<V, Seq>where Seq: Unpin, V: Unpin,

§

impl<V, Seq> UnwindSafe for Counter<V, Seq>where Seq: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

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

§

fn vzip(self) -> V