Add docs.rs feature flag labels to `incrementalmerkletree` and `shardtree`

This commit is contained in:
Jack Grigg 2023-07-27 22:57:09 +00:00
parent e7a38c0ee9
commit f5fd2a0a3e
5 changed files with 20 additions and 2 deletions

View File

@ -13,6 +13,10 @@ repository = "https://github.com/zcash/incrementalmerkletree"
categories = ["algorithms", "data-structures"]
rust-version = "1.60"
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
either = "1.8"
proptest = { version = "1.0.0", optional = true }
@ -21,10 +25,10 @@ proptest = { version = "1.0.0", optional = true }
proptest = "1.0.0"
[features]
# The legacy-api feature guards types and functions that were previously
# The legacy-api feature guards types and functions that were previously
# part of the `zcash_primitives` crate. Those types were removed in the
# `zcash_primitives` 0.12 release and are now maintained here.
legacy-api = []
# The test-dependencies feature guards types and functions that are
# The test-dependencies feature guards types and functions that are
# useful for testing incremental Merkle trees and Merkle tree frontiers.
test-dependencies = ["proptest"]

View File

@ -281,6 +281,7 @@ impl<H: Hashable + Clone, const DEPTH: u8> Frontier<H, DEPTH> {
}
#[cfg(feature = "legacy-api")]
#[cfg_attr(docsrs, doc(cfg(feature = "legacy-api")))]
pub struct PathFiller<H> {
queue: VecDeque<H>,
}
@ -307,6 +308,7 @@ impl<H: Hashable> PathFiller<H> {
/// A Merkle tree of note commitments.
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg(feature = "legacy-api")]
#[cfg_attr(docsrs, doc(cfg(feature = "legacy-api")))]
pub struct CommitmentTree<H, const DEPTH: u8> {
pub(crate) left: Option<H>,
pub(crate) right: Option<H>,
@ -600,6 +602,7 @@ pub mod testing {
use crate::frontier::CommitmentTree;
#[cfg(feature = "legacy-api")]
#[cfg_attr(docsrs, doc(cfg(feature = "legacy-api")))]
pub fn arb_commitment_tree<
H: Hashable + Clone + Debug,
T: Strategy<Value = H>,

View File

@ -43,6 +43,8 @@
//! Note: we often refer to `ommers` (plural) when describing leaf-to-root paths, so in that
//! context `ommers` refers to the node's ommer, plus each ancestor's ommer.
#![cfg_attr(docsrs, feature(doc_cfg))]
use either::Either;
use std::cmp::Ordering;
use std::convert::{TryFrom, TryInto};
@ -53,9 +55,11 @@ use std::ops::{Add, AddAssign, Range, Sub};
pub mod frontier;
#[cfg(feature = "legacy-api")]
#[cfg_attr(docsrs, doc(cfg(feature = "legacy-api")))]
pub mod witness;
#[cfg(feature = "test-dependencies")]
#[cfg_attr(docsrs, doc(cfg(feature = "test-dependencies")))]
pub mod testing;
/// A type for metadata that is used to determine when and how a leaf can be pruned from a tree.

View File

@ -12,6 +12,10 @@ homepage = "https://github.com/zcash/incrementalmerkletree"
repository = "https://github.com/zcash/incrementalmerkletree"
categories = ["algorithms", "data-structures"]
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
assert_matches = { version = "1.5", optional = true }
bitflags = "1.3"

View File

@ -20,6 +20,8 @@
//! to be inserted, along with the necessary nodes to build a path from the marked leaf to
//! the root of the shard containing it.
#![cfg_attr(docsrs, feature(doc_cfg))]
use core::fmt::Debug;
use either::Either;
use std::collections::{BTreeMap, BTreeSet};
@ -51,6 +53,7 @@ pub mod store;
pub mod testing;
#[cfg(feature = "legacy-api")]
#[cfg_attr(docsrs, doc(cfg(feature = "legacy-api")))]
mod legacy;
/// A sparse binary Merkle tree of the specified depth, represented as an ordered collection of