Crate commonware_utils

Source
Expand description

Leverage common functionality across multiple primitives.

Re-exports§

pub use array::Array;

Modules§

array
futures
Utilities for working with futures.

Macros§

NZU32
A macro to create a NonZeroU32 from a value, panicking if the value is zero.
NZU64
A macro to create a NonZeroU64 from a value, panicking if the value is zero.
NZUsize
A macro to create a NonZeroUsize from a value, panicking if the value is zero.

Structs§

BitIterator
Iterator over bits in a BitVec
BitVec
Represents a vector of bits.
PrioritySet
A set that offers efficient iteration over its elements in priority-ascending order.

Enums§

StableBuf
A buffer whose memory is stable as long as its not reallocated.

Traits§

SystemTimeExt
Extension trait to add methods to std::time::SystemTime

Functions§

from_hex
Converts a hexadecimal string to bytes.
from_hex_formatted
Converts a hexadecimal string to bytes, stripping whitespace and/or a 0x prefix. Commonly used in testing to encode external test vectors without modification.
hex
Converts bytes to a hexadecimal string.
max_faults
Compute the maximum number of f (faults) that can be tolerated for a given set of n participants. This is the maximum integer f such that n >= 3*f + 1. f may be zero.
modulo
Compute the modulo of bytes interpreted as a big-endian integer.
quorum
Compute the quorum size for a given set of n participants. This is the minimum integer q such that 3*q >= 2*n + 1. It is also equal to n - f, where f is the maximum number of faults.
union
Computes the union of two byte slices.
union_unique
Concatenate a namespace and a message, prepended by a varint encoding of the namespace length.