multihash/
lib.rs

1//! Bare-minimum multihash data structure.
2//!
3//! This crate defines a `no_std` compatible data structures for representing a `Multihash`.
4//!
5//! It does not offer any hashing, instead you are encouraged to either do the hashing yourself.
6//! Alternatively, you can use an existing code table or make your own code table.
7//!
8//! The [`multihash-codetable`] crate defines a set of hashes to get started quickly.
9//! To make your own codetable, use the [`multihash-derive`] crate.
10//!
11//! The `arb` feature flag enables the quickcheck arbitrary implementation for property based
12//! testing.
13//!
14//! For serializing the multihash there is support for [Serde] via the `serde-codec` feature and
15//! the [SCALE Codec] via the `scale-codec` feature.
16//!
17//! [Serde]: https://serde.rs
18//! [SCALE Codec]: https://github.com/paritytech/parity-scale-codec
19//! [`multihash-derive`]: https://docs.rs/multihash-derive
20//! [`multihash-codetable`]: https://docs.rs/multihash-codetable
21
22#![deny(missing_docs, unsafe_code)]
23#![cfg_attr(not(feature = "std"), no_std)]
24
25#[cfg(feature = "alloc")]
26extern crate alloc;
27
28#[cfg(any(test, feature = "arb"))]
29mod arb;
30mod error;
31mod multihash;
32#[cfg(feature = "serde")]
33mod serde;
34
35/// Multihash result.
36#[deprecated(note = "Use `Result<T, multihash::Error>` instead")]
37pub type Result<T> = core::result::Result<T, Error>;
38
39pub use crate::error::Error;
40pub use crate::multihash::Multihash;
41
42/// Deprecated type-alias for the [`Multihash`] type.
43#[deprecated(since = "0.18.0", note = "Use `multihash::Multihash instead.")]
44pub type MultihashGeneric<const N: usize> = Multihash<N>;