Skip to content

Commit

Permalink
Use doc_cfg to improve register_custom_getrandom docs
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Jan 17, 2021
1 parent 9a48bfa commit 69634b7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ test-in-browser = []

[package.metadata.docs.rs]
features = ["std", "custom"]
rustdoc-args = ["--cfg", "docsrs"]
3 changes: 1 addition & 2 deletions src/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ use core::num::NonZeroU32;

/// Register a function to be invoked by `getrandom` on unsupported targets.
///
/// *This API requires the `"custom"` Cargo feature to be activated*.
///
/// ## Writing a custom `getrandom` implementation
///
/// The function to register must have the same signature as
Expand Down Expand Up @@ -75,6 +73,7 @@ use core::num::NonZeroU32;
/// [top-level documentation](index.html#custom-implementations) this
/// registration only has an effect on unsupported targets.
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "custom")))]
macro_rules! register_custom_getrandom {
($path:path) => {
// We use an extern "C" function to get the guarantees of a stable ABI.
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
)]
#![no_std]
#![warn(rust_2018_idioms, unused_lifetimes, missing_docs)]
#![cfg_attr(docsrs, feature(doc_cfg))]

#[macro_use]
extern crate cfg_if;
Expand Down

0 comments on commit 69634b7

Please sign in to comment.