Skip to content

Commit

Permalink
Add docs.rs feature flag labels to incrementalmerkletree and `shard…
Browse files Browse the repository at this point in the history
…tree`
  • Loading branch information
str4d committed Jul 27, 2023
1 parent e7a38c0 commit f5fd2a0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
8 changes: 6 additions & 2 deletions incrementalmerkletree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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"]
3 changes: 3 additions & 0 deletions incrementalmerkletree/src/frontier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
}
Expand All @@ -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>,
Expand Down Expand Up @@ -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>,
Expand Down
4 changes: 4 additions & 0 deletions incrementalmerkletree/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions shardtree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions shardtree/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f5fd2a0

Please sign in to comment.