Struct libdata::flow::Speed []

pub struct Speed(pub u64);

A transfer speed.

This specifies the speed of transfer in bytes per second, rounded to whole bytes per second.

Methods

impl Speed
[src]

Computes the speed from the amount of data transfered and time it took.

This computes the speed simply as bytes / time. However, it shields the caller from bunch of technical details, like type conversions, the right units, rounding...

Note

The time is taken as one second long if it is shorter. This is to prevent various strange things from happening, like:

  • Division by zero.
  • Producing strange spikes for single-packet or very short flows (eg. it is possible to send several packets into a buffer in a very short time without the network having that actual speed).

Parameters

  • bytes: The amount of bytes transferred.
  • time: How long it took.

Trait Implementations

impl Add for Speed

The resulting type after applying the + operator

The method for the + operator

impl AddAssign for Speed

The method for the += operator

impl Clone for Speed
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Speed
[src]

impl Debug for Speed
[src]

Formats the value using the given formatter.

impl Default for Speed
[src]

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

impl Eq for Speed
[src]

impl From<u64> for Speed

Performs the conversion.

impl Hash for Speed
[src]

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

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

impl Ord for Speed
[src]

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

🔬 This is a nightly-only experimental API. (ord_max_min)

Compares and returns the maximum of two values. Read more

🔬 This is a nightly-only experimental API. (ord_max_min)

Compares and returns the minimum of two values. Read more

impl PartialEq for Speed
[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 Speed
[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