[][src]Struct sdset::Counter

pub struct Counter(pub usize);

A Collection that only counts the final size of a set operation.

It is meant to be used to avoid unecessary allocations.

use sdset::duo::OpBuilder;
use sdset::{SetOperation, Set, SetBuf, Counter};

let a = Set::new(&[1, 2, 4, 6, 7])?;
let b = Set::new(&[2, 3, 4, 5, 6, 7])?;

let op = OpBuilder::new(a, b).union();

let mut counter = Counter::default();
SetOperation::<i32>::extend_collection(op, &mut counter);

assert_eq!(counter.0, 7);

Methods

impl Counter[src]

pub fn new() -> Counter[src]

Create a new Counter initialized with 0;

Trait Implementations

impl<T> Collection<T> for Counter[src]

impl Default for Counter[src]

Auto Trait Implementations

impl RefUnwindSafe for Counter

impl Send for Counter

impl Sync for Counter

impl Unpin for Counter

impl UnwindSafe for Counter

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.