Crate commonware_utils

Crate commonware_utils 

Source
Expand description

Leverage common functionality across multiple primitives.

Re-exports§

pub use faults::Faults;
pub use faults::N3f1;
pub use faults::N5f1;
pub use sequence::Array;
pub use sequence::Span;
pub use acknowledgement::Acknowledgement;
pub use hostname::Hostname;
pub use net::IpAddrExt;
pub use time::DurationExt;
pub use time::SystemTimeExt;
pub use rational::BigRationalExt;

Modules§

acknowledgement
Utilities for providing acknowledgement.
bitmap
Bitmap implementation
channels
Utilities for working with channels.
concurrency
Utilities for managing concurrency.
faults
Byzantine fault tolerance models for consensus protocols.
futures
Utilities for working with futures.
hex_literal
Hex literal macro implementation.
hostname
Validated hostname type conforming to RFC 1035/1123.
net
Utilities for working with IP addresses.
ordered
Ordered collections that guarantee sorted, deduplicated items.
rational
Utilities for working with num_rational::BigRational.
sequence
time
Utility functions for std::time.
vec
A vector type that guarantees at least one element.

Macros§

NZDuration
A macro to create a NonZeroDuration from a duration, panicking if the duration is zero.
NZU8
A macro to create a NonZeroU8 from a value, panicking if the value is zero. For literal values, validation occurs at compile time. For expressions, validation occurs at runtime.
NZU16
A macro to create a NonZeroU16 from a value, panicking if the value is zero. For literal values, validation occurs at compile time. For expressions, validation occurs at runtime.
NZU32
A macro to create a NonZeroU32 from a value, panicking if the value is zero. For literal values, validation occurs at compile time. For expressions, validation occurs at runtime.
NZU64
A macro to create a NonZeroU64 from a value, panicking if the value is zero. For literal values, validation occurs at compile time. For expressions, validation occurs at runtime.
NZUsize
A macro to create a NonZeroUsize from a value, panicking if the value is zero. For literal values, validation occurs at compile time. For expressions, validation occurs at runtime.
fixed_bytes
Macro for converting sequence of string literals containing hex-encoded data into a FixedBytes type.
hex
Macro for converting sequence of string literals containing hex-encoded data into an array of bytes.
hostname
Creates a Hostname from a string literal or expression.
non_empty_vec
Creates a NonEmptyVec containing the given elements.

Structs§

NonZeroDuration
A wrapper around Duration that guarantees the duration is non-zero.
Participant
Represents a participant/validator index within a consensus committee.
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§

TryCollect
Extension trait for iterators that provides fallible collection.
TryFromIterator
A type that can be constructed from an iterator, possibly failing.

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.
modulo
Compute the modulo of bytes interpreted as a big-endian integer.
test_rng
Returns a seeded RNG for deterministic testing.
test_rng_seeded
Returns a seeded RNG with a custom seed for deterministic testing.
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.

Type Aliases§

BoxedError
Alias for boxed errors that are Send and Sync.