Crate tari_utilities

Source
Expand description

A set of useful and commonly used utilities that are used in several places in the Tari project.

Re-exports§

pub use self::byte_array::ByteArray;
pub use self::byte_array::ByteArrayError;
pub use self::hash::Hashable;
pub use self::hidden::Hidden;
pub use self::password::SafePassword;

Modules§

bit
Functions for conversion between integer and bit array.
byte_array
A trait that offers representation of data types as a byte array or hex string.
convert
Function which tries to convert a series of Ts to Us.
encoding
A trait that handles base58 encoding and decoding.
epoch_time
Data structure representing time as a u64.
fixed_set
Data structure describing a fixed set of size n.
hash
A simple Hashable trait which is used to describe how an object should be hashed.
hex
Functions for conversion between binary and hex string.
hidden
Sometimes you need to handle sensitive data, like a passphrase or key material. There are pitfalls here that you want to avoid: the data should be zeroized when it goes out of scope, shouldn’t be displayed or output to debug logs, shouldn’t be unintentionally copied or moved, and often should have strict type differentiation to avoid it being misused in an unintended context. This library provides a generic type and macro that can help.
locks
Macros for RwLock.
message_format
A MessageFormat trait that handles conversion from and to binary, json, or base64.
password
A type for handling a passphrase safely.
safe_array
An array-like type with safety features that make it suitable for cryptographic keys.
serde
A module with serialization utilities.

Macros§

acquire_lock
This macro returns a Mutex or RwLock guard without returning a PoisonError. If the lock is poisoned (i.e. a panic before a MutexGuard / RwLockGuard is dropped), the last value before the panic occurred is used. The semantics of this macro are similar to a database transaction rollback on failure.
acquire_read_lock
Acquire a read lock on a RwLock, silently recovering the lock if it is poisoned
acquire_write_lock
Acquire a write lock on a RwLock, silently recovering the lock if it is poisoned
hidden_type
This is a macro that produces a hidden type from an underlying data type.
recover_lock
Recovers a poisoned lock by returning the value before the lock was poisoned