zcash_proofs: Add feature flags to docs.rs documentation
This commit is contained in:
parent
a3cb89dff9
commit
cda56ef862
|
@ -11,6 +11,9 @@ readme = "README.md"
|
|||
license = "MIT OR Apache-2.0"
|
||||
edition = "2018"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
[dependencies]
|
||||
bellman = { version = "0.6", path = "../bellman", default-features = false, features = ["groth16"] }
|
||||
blake2b_simd = "0.5"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//! `zcash_proofs` contains the zk-SNARK circuits used by Zcash, and the APIs for creating
|
||||
//! and verifying proofs.
|
||||
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
// Catch documentation errors caused by code changes.
|
||||
#![deny(intra_doc_link_resolution_failure)]
|
||||
|
||||
|
@ -24,6 +25,10 @@ pub mod sapling;
|
|||
pub mod sprout;
|
||||
|
||||
#[cfg(any(feature = "local-prover", feature = "bundled-prover"))]
|
||||
#[cfg_attr(
|
||||
docsrs,
|
||||
doc(cfg(any(feature = "local-prover", feature = "bundled-prover")))
|
||||
)]
|
||||
pub mod prover;
|
||||
|
||||
// Circuit names
|
||||
|
@ -42,6 +47,7 @@ const DOWNLOAD_URL: &str = "https://download.z.cash/downloads";
|
|||
|
||||
/// Returns the default folder that the Zcash proving parameters are located in.
|
||||
#[cfg(feature = "directories")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "directories")))]
|
||||
pub fn default_params_folder() -> Option<PathBuf> {
|
||||
BaseDirs::new().map(|base_dirs| {
|
||||
if cfg!(any(windows, target_os = "macos")) {
|
||||
|
@ -56,6 +62,7 @@ pub fn default_params_folder() -> Option<PathBuf> {
|
|||
///
|
||||
/// This mirrors the behaviour of the `fetch-params.sh` script from `zcashd`.
|
||||
#[cfg(feature = "download-params")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "download-params")))]
|
||||
pub fn download_parameters() -> Result<(), minreq::Error> {
|
||||
// Ensure that the default Zcash parameters location exists.
|
||||
let params_dir = default_params_folder().ok_or(io::Error::new(
|
||||
|
|
|
@ -49,6 +49,7 @@ impl LocalTxProver {
|
|||
/// This function will panic if the paths do not point to valid parameter files with
|
||||
/// the expected hashes.
|
||||
#[cfg(feature = "local-prover")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "local-prover")))]
|
||||
pub fn new(spend_path: &Path, output_path: &Path) -> Self {
|
||||
let (spend_params, spend_vk, output_params, _, _) =
|
||||
load_parameters(spend_path, output_path, None);
|
||||
|
@ -81,6 +82,7 @@ impl LocalTxProver {
|
|||
/// This function will panic if the parameters in the default local location do not
|
||||
/// have the expected hashes.
|
||||
#[cfg(feature = "local-prover")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "local-prover")))]
|
||||
pub fn with_default_location() -> Option<Self> {
|
||||
let params_dir = default_params_folder()?;
|
||||
let (spend_path, output_path) = if params_dir.exists() {
|
||||
|
@ -103,6 +105,7 @@ impl LocalTxProver {
|
|||
/// This requires the `bundled-prover` feature, which will increase the binary size by
|
||||
/// around 50 MiB.
|
||||
#[cfg(feature = "bundled-prover")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "bundled-prover")))]
|
||||
pub fn bundled() -> Self {
|
||||
let (spend_buf, output_buf) = wagyu_zcash_parameters::load_sapling_parameters();
|
||||
let (spend_params, spend_vk, output_params, _, _) =
|
||||
|
|
Loading…
Reference in New Issue