Struct plumtree::time::Clock[][src]

pub struct Clock(_);

Node local clock.

Each Node has a clock instance. When a node is created, the time of its clock is initialized to zero. Then each time Clock::tick method is called, the time of the clock proceeds by the specified duration.

Methods

impl Clock
[src]

Makes a new Clock instance.

Examples

use plumtree::time::Clock;
use std::time::Duration;

assert_eq!(Clock::new().now().as_duration(), Duration::from_secs(0));

Returns the current time of the clock.

Examples

use plumtree::time::Clock;
use std::time::Duration;

let mut clock = Clock::new();
assert_eq!(clock.now().as_duration(), Duration::from_secs(0));

clock.tick(Duration::from_secs(100));
assert_eq!(clock.now().as_duration(), Duration::from_secs(100));

Proceeds the time of the clock by the given duration.

Trait Implementations

impl Debug for Clock
[src]

Formats the value using the given formatter. Read more

impl Default for Clock
[src]

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

impl Clone for Clock
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Clock
[src]

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

This method tests for !=.

impl Eq for Clock
[src]

impl Hash for Clock
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl PartialOrd for Clock
[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 Ord for Clock
[src]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Auto Trait Implementations

impl Send for Clock

impl Sync for Clock