pub struct TrackChannel<C>(/* private fields */);
Expand description

A channel wrapping another channel for tracking the number of bits read/written.

Implementations§

source§

impl<C: AbstractChannel> TrackChannel<C>

source

pub fn new(channel: C) -> Self

Make a new TrackChannel from a reader and a writer.

source

pub fn clear(&mut self)

Clear the number of bits read/written.

source

pub fn kilobits_written(&self) -> f64

Return the number of kilobits written to the channel.

source

pub fn kilobits_read(&self) -> f64

Return the number of kilobits read from the channel.

source

pub fn total_kilobits(&self) -> f64

Return the total amount of communication on the channel.

source

pub fn kilobytes_written(&self) -> f64

Return the number of kilobytes written to the channel.

source

pub fn kilobytes_read(&self) -> f64

Return the number of kilobytes read from the channel.

source

pub fn total_kilobytes(&self) -> f64

Return the total amount of communication on the channel as kilobytes.

Trait Implementations§

source§

impl<C: AbstractChannel> AbstractChannel for TrackChannel<C>

source§

fn write_bytes(&mut self, bytes: &[u8]) -> Result<()>

Write a slice of u8s to the channel.
source§

fn read_bytes(&mut self, bytes: &mut [u8]) -> Result<()>

Read a slice of u8s from the channel.
source§

fn flush(&mut self) -> Result<()>

Flush the channel.
source§

fn clone(&self) -> Self

Clone the channel.
source§

fn read_vec(&mut self, nbytes: usize) -> Result<Vec<u8>>

Read nbytes from the channel, and return it as a Vec.
source§

fn write_bool(&mut self, b: bool) -> Result<()>

Write a bool to the channel.
source§

fn read_bool(&mut self) -> Result<bool>

Read a bool from the channel.
source§

fn write_u8(&mut self, s: u8) -> Result<()>

Write a u8 to the channel.
source§

fn read_u8(&mut self) -> Result<u8>

Read a u8 from the channel.
source§

fn write_u16(&mut self, s: u16) -> Result<()>

Write a u16 to the channel.
source§

fn read_u16(&mut self) -> Result<u16>

Read a u16 from the channel.
source§

fn write_u32(&mut self, s: u32) -> Result<()>

Write a u32 to the channel.
source§

fn read_u32(&mut self) -> Result<u32>

Read a u32 from the channel.
source§

fn write_u64(&mut self, s: u64) -> Result<()>

Write a u64 to the channel.
source§

fn read_u64(&mut self) -> Result<u64>

Read a u64 from the channel.
source§

fn write_usize(&mut self, s: usize) -> Result<()>

Write a usize to the channel.
source§

fn read_usize(&mut self) -> Result<usize>

Read a usize from the channel.
source§

fn write_block(&mut self, b: &Block) -> Result<()>

Write a Block to the channel.
source§

fn read_block(&mut self) -> Result<Block>

Read a Block from the channel.
source§

fn read_blocks(&mut self, n: usize) -> Result<Vec<Block>>

Read n Blocks from the channel.
source§

fn write_block512(&mut self, b: &Block512) -> Result<()>

Write a Block512 to the channel.
source§

fn read_block512(&mut self) -> Result<Block512>

Read a Block512 from the channel.
source§

fn write_pt(&mut self, pt: &RistrettoPoint) -> Result<()>

Write a RistrettoPoint to the channel.
source§

fn read_pt(&mut self) -> Result<RistrettoPoint>

Read a RistrettoPoint from the channel.
source§

fn read_serializable<E: CanonicalSerialize>(&mut self) -> Result<E>

Read a CanonicalSerialize object from the channel.
source§

fn write_serializable<E: CanonicalSerialize>(&mut self, x: &E) -> Result<()>

Write a CanonicalSerialize object to the channel.

Auto Trait Implementations§

§

impl<C> Freeze for TrackChannel<C>

§

impl<C> RefUnwindSafe for TrackChannel<C>

§

impl<C> Send for TrackChannel<C>
where C: Send,

§

impl<C> Sync for TrackChannel<C>
where C: Send,

§

impl<C> Unpin for TrackChannel<C>

§

impl<C> UnwindSafe for TrackChannel<C>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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 T
where V: MultiLane<T>,

§

fn vzip(self) -> V