coins_core/
lib.rs

1//! # Coins Core
2//!
3//! `coins-core` contains utilities and traits used by the `coins-bip32` and
4//! `coins-bip39` crates.
5//!
6//! ## Crate Layout
7//!
8//! ### Hashes
9//!
10//! The hashes module provides utilities for newtyping hash outputs, including
11//! sha2, sha3, and ripemd160. These newtypes are called `Marked__` and are
12//! intended to be used for a specific purpose. E.g. `Hash256` is a marked type
13//! for Bitcoin's double-sha2, while `Hash160` is a marked type for Bitcoin's
14//! `ripemd160(sha2(x))`.
15//!
16//! #### Ser trait
17//!
18//! The `Ser` trait is a simple serialization API using
19//! `std::io::{Read, Write}`. Implementers define the binary serialization
20//! format of the type, as well as the JSON serialization. The transaction type
21//! must implement `Ser`, as the provided `txid` logic assumes access to the
22//! `serialize` method.
23//!
24//! `Ser` has an associated `Error` type. Most basic types can simply use the
25//! provided `SerError`. However, more complex (de)serialization will want to
26//! implement a custom error type to handle (e.g.) invalid transactions. These
27//! types must be easily instantiated from a `SerError` or an `std::io::Error`.
28
29#![forbid(unsafe_code)]
30#![warn(missing_docs)]
31#![warn(unused_extern_crates)]
32
33#[macro_use]
34pub mod macros;
35
36pub mod hashes;
37pub mod ser;