[][src]Crate grin_util

Logging, as well as various low-level utilities that factor Rust patterns that are frequent within the grin codebase.

Re-exports

pub extern crate secp256k1zkp as secp;
pub use logger::init_logger;
pub use logger::init_test_logger;
pub use secp_static::static_secp_instance;
pub use types::LogLevel;
pub use types::LoggingConfig;

Modules

file

File util

logger

Logging wrapper to be used throughout all crates in the workspace

macros

Macros to support Rust BIP-32 code (though could conceivably be used for other things)

read_write

Custom impls of read_exact and write_all to work around async stream restrictions.

secp_static

Globally accessible static instance of secp256k1, to avoid initialization overhead

types

Logging configuration types

zip

Compress and decompress zip bz2 archives

Macros

impl_array_newtype
impl_array_newtype_encodable
impl_array_newtype_show
impl_index_newtype

Structs

OneTime

Encapsulation of a RwLock<Option> for one-time initialization. This implementation will purposefully fail hard if not used properly, for example if not initialized before being first used (borrowed).

RateCounter

A rate counter tracks the number of transfers, the amount of data exchanged and the rate of transfer (via a few timers) over the last minute. The counter does not try to be accurate and update times proactively, instead it only does so lazily. As a result, produced rates are worst-case estimates.

Functions

from_hex

Decode a hex string into bytes.

to_base64

Encode an utf8 string to a base64 string

to_hex

Encode the provided bytes into a hex string

Type Definitions

Mutex

A mutual exclusion primitive useful for protecting shared data

RwLock

A reader-writer lock