Struct incr::Incr[][src]

pub struct Incr(_);

A self-contained struct for quickly checking whether a newly observed value is greater than any previously observed value.

Examples

use incr::Incr;
let mut last = Incr::default();
assert_eq!(last.is_new(1), true);
assert_eq!(last.is_new(1), false);
assert_eq!(last.is_new(2), true);
assert_eq!(last.get(), 2);

Methods

impl Incr
[src]

Returns true if val is greater than the highest previously observed value. If val is a new maximum, it is stored in self for checks against future values subsequent calls Self::get(&self) will return val until a new max is observed.

Returns the current value of self, which is the maximum observed value.

Trait Implementations

impl Default for Incr
[src]

Returns the "default value" for a type. Read more

impl Clone for Incr
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Incr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialOrd for Incr
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Eq for Incr
[src]

impl Debug for Incr
[src]

Formats the value using the given formatter. Read more

impl From<u64> for Incr
[src]

Performs the conversion.

Auto Trait Implementations

impl Send for Incr

impl Sync for Incr