*: Use auto_doc_cfg instead of doc(cfg) attributes (#2983)

Co-authored-by: João Oliveira <hello@jxs.pt>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
This commit is contained in:
Hannes
2022-10-24 04:00:20 +02:00
committed by GitHub
parent 159a10b812
commit fcadc83aca
61 changed files with 271 additions and 53 deletions

View File

@ -78,9 +78,6 @@ serde = ["libp2p-core/serde", "libp2p-kad?/serde", "libp2p-gossipsub?/serde"]
tokio = ["libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio"] tokio = ["libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio"]
async-std = ["libp2p-mdns?/async-io", "libp2p-tcp?/async-io", "libp2p-dns?/async-std"] async-std = ["libp2p-mdns?/async-io", "libp2p-tcp?/async-io", "libp2p-dns?/async-std"]
[package.metadata.docs.rs]
all-features = true
[dependencies] [dependencies]
bytes = "1" bytes = "1"
futures = "0.3.1" futures = "0.3.1"
@ -204,3 +201,10 @@ required-features = ["full"]
[[example]] [[example]]
name = "distributed-key-value-store" name = "distributed-key-value-store"
required-features = ["full"] required-features = ["full"]
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -64,3 +64,10 @@ serde = ["multihash/serde-codec", "dep:serde"]
[[bench]] [[bench]]
name = "peer_id" name = "peer_id"
harness = false harness = false
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -35,6 +35,8 @@
//! define how to upgrade each individual substream to use a protocol. //! define how to upgrade each individual substream to use a protocol.
//! See the `upgrade` module. //! See the `upgrade` module.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
mod keys_proto { mod keys_proto {
include!(concat!(env!("OUT_DIR"), "/keys_proto.rs")); include!(concat!(env!("OUT_DIR"), "/keys_proto.rs"));

View File

@ -38,3 +38,10 @@ futures = "0.3.1"
libp2p = { path = "../..", features = ["full"] } libp2p = { path = "../..", features = ["full"] }
hyper = { version="0.14", features = ["server", "tcp", "http1"] } hyper = { version="0.14", features = ["server", "tcp", "http1"] }
tokio = { version = "1", features = ["rt-multi-thread"] } tokio = { version = "1", features = ["rt-multi-thread"] }
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -25,6 +25,8 @@
//! //!
//! See `examples` directory for more. //! See `examples` directory for more.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#[cfg(feature = "dcutr")] #[cfg(feature = "dcutr")]
mod dcutr; mod dcutr;
#[cfg(feature = "gossipsub")] #[cfg(feature = "gossipsub")]

View File

@ -25,3 +25,10 @@ libp2p = { path = "../..", features = ["full"] }
quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" } quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" }
rand = "0.8" rand = "0.8"
rw-stream-sink = { version = "0.3.0", path = "../../misc/rw-stream-sink" } rw-stream-sink = { version = "0.3.0", path = "../../misc/rw-stream-sink" }
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -87,6 +87,8 @@
//! ``` //! ```
//! //!
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
mod dialer_select; mod dialer_select;
mod length_delimited; mod length_delimited;
mod listener_select; mod listener_select;

View File

@ -19,3 +19,10 @@ unsigned-varint = { version = "0.7", features = ["asynchronous_codec"] }
[dev-dependencies] [dev-dependencies]
prost-build = "0.11" prost-build = "0.11"
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -1,3 +1,5 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use asynchronous_codec::{Decoder, Encoder}; use asynchronous_codec::{Decoder, Encoder};
use bytes::BytesMut; use bytes::BytesMut;
use prost::Message; use prost::Message;

View File

@ -1,3 +1,5 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
pub use quickcheck::*; pub use quickcheck::*;
use core::ops::Range; use core::ops::Range;

View File

@ -16,3 +16,10 @@ static_assertions = "1"
[dev-dependencies] [dev-dependencies]
async-std = "1.0" async-std = "1.0"
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -25,6 +25,8 @@
//! Each call to [`AsyncWrite::poll_write`] will send one packet to the sink. //! Each call to [`AsyncWrite::poll_write`] will send one packet to the sink.
//! Calls to [`AsyncRead::poll_read`] will read from the stream's incoming packets. //! Calls to [`AsyncRead::poll_read`] will read from the stream's incoming packets.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use futures::{prelude::*, ready}; use futures::{prelude::*, ready};
use std::{ use std::{
io::{self, Read}, io::{self, Read},

View File

@ -34,3 +34,10 @@ quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" }
[[bench]] [[bench]]
name = "split_send_size" name = "split_send_size"
harness = false harness = false
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -18,6 +18,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
mod codec; mod codec;
mod config; mod config;
mod io; mod io;

View File

@ -21,3 +21,10 @@ log = "0.4"
[dev-dependencies] [dev-dependencies]
async-std = { version = "1.7.0", features = ["attributes"] } async-std = { version = "1.7.0", features = ["attributes"] }
libp2p-muxer-test-harness = { path = "../test-harness" } libp2p-muxer-test-harness = { path = "../test-harness" }
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -21,6 +21,8 @@
//! Implements the Yamux multiplexing protocol for libp2p, see also the //! Implements the Yamux multiplexing protocol for libp2p, see also the
//! [specification](https://github.com/hashicorp/yamux/blob/master/spec.md). //! [specification](https://github.com/hashicorp/yamux/blob/master/spec.md).
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use futures::{ use futures::{
future, future,
prelude::*, prelude::*,

View File

@ -30,3 +30,10 @@ async-std = { version = "1.10", features = ["attributes"] }
env_logger = "0.9" env_logger = "0.9"
clap = { version = "4.0.13", features = ["derive"] } clap = { version = "4.0.13", features = ["derive"] }
libp2p = { path = "../..", features = ["full"] } libp2p = { path = "../..", features = ["full"] }
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -19,6 +19,9 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
//! Implementation of the AutoNAT protocol. //! Implementation of the AutoNAT protocol.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
mod behaviour; mod behaviour;
mod protocol; mod protocol;

View File

@ -33,3 +33,10 @@ env_logger = "0.9.0"
libp2p = { path = "../..", features = ["full"] } libp2p = { path = "../..", features = ["full"] }
rand = "0.8" rand = "0.8"
clap = { version = "4.0.13", features = ["derive"] } clap = { version = "4.0.13", features = ["derive"] }
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -21,6 +21,8 @@
//! Implementation of the [libp2p Direct Connection Upgrade through Relay //! Implementation of the [libp2p Direct Connection Upgrade through Relay
//! specification](https://github.com/libp2p/specs/blob/master/relay/DCUtR.md). //! specification](https://github.com/libp2p/specs/blob/master/relay/DCUtR.md).
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
pub mod behaviour; pub mod behaviour;
mod handler; mod handler;
mod protocol; mod protocol;

View File

@ -23,3 +23,10 @@ smallvec = "1.6.1"
[build-dependencies] [build-dependencies]
prost-build = "0.11" prost-build = "0.11"
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -21,6 +21,8 @@
//! Implements the floodsub protocol, see also the: //! Implements the floodsub protocol, see also the:
//! [spec](https://github.com/libp2p/specs/tree/master/pubsub). //! [spec](https://github.com/libp2p/specs/tree/master/pubsub).
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use libp2p_core::PeerId; use libp2p_core::PeerId;
pub mod protocol; pub mod protocol;

View File

@ -43,3 +43,10 @@ derive_builder = "0.11.1"
[build-dependencies] [build-dependencies]
prost-build = "0.11" prost-build = "0.11"
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -133,6 +133,8 @@
//! println!("Listening on {:?}", addr); //! println!("Listening on {:?}", addr);
//! ``` //! ```
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
pub mod error; pub mod error;
pub mod protocol; pub mod protocol;

View File

@ -31,3 +31,10 @@ libp2p = { path = "../..", features = ["full"] }
[build-dependencies] [build-dependencies]
prost-build = "0.11" prost-build = "0.11"
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -39,6 +39,8 @@
//! that negotiates and executes the protocol on every established connection, emitting //! that negotiates and executes the protocol on every established connection, emitting
//! [`Event`]s. //! [`Event`]s.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
pub use self::behaviour::{Behaviour, Config, Event}; pub use self::behaviour::{Behaviour, Config, Event};
pub use self::protocol::{Info, UpgradeError, PROTOCOL_NAME, PUSH_PROTOCOL_NAME}; pub use self::protocol::{Info, UpgradeError, PROTOCOL_NAME, PUSH_PROTOCOL_NAME};

View File

@ -43,3 +43,10 @@ prost-build = "0.11"
[features] [features]
serde = ["dep:serde", "bytes/serde"] serde = ["dep:serde", "bytes/serde"]
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -38,6 +38,7 @@
// TODO: we allow dead_code for now because this library contains a lot of unused code that will // TODO: we allow dead_code for now because this library contains a lot of unused code that will
// be useful later for record store // be useful later for record store
#![allow(dead_code)] #![allow(dead_code)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
pub mod handler; pub mod handler;
pub mod kbucket; pub mod kbucket;

View File

@ -45,3 +45,10 @@ required-features = ["async-io"]
name = "use-tokio" name = "use-tokio"
required-features = ["tokio"] required-features = ["tokio"]
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -30,6 +30,9 @@
//! implements the `NetworkBehaviour` trait. This struct will automatically discover other //! implements the `NetworkBehaviour` trait. This struct will automatically discover other
//! libp2p nodes on the local network. //! libp2p nodes on the local network.
//! //!
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use std::net::{Ipv4Addr, Ipv6Addr}; use std::net::{Ipv4Addr, Ipv6Addr};
use std::time::Duration; use std::time::Duration;

View File

@ -24,3 +24,10 @@ void = "1.0"
async-std = "1.6.2" async-std = "1.6.2"
libp2p = { path = "../..", features = ["full"] } libp2p = { path = "../..", features = ["full"] }
quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" } quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" }
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -40,6 +40,8 @@
//! [`Swarm`]: libp2p_swarm::Swarm //! [`Swarm`]: libp2p_swarm::Swarm
//! [`Transport`]: libp2p_core::Transport //! [`Transport`]: libp2p_core::Transport
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
mod handler; mod handler;
mod protocol; mod protocol;

View File

@ -37,3 +37,10 @@ env_logger = "0.9.0"
libp2p = { path = "../..", features = ["full"] } libp2p = { path = "../..", features = ["full"] }
quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" } quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" }
clap = { version = "4.0.13", features = ["derive"] } clap = { version = "4.0.13", features = ["derive"] }
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -21,6 +21,8 @@
//! libp2p circuit relay implementations //! libp2p circuit relay implementations
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
pub mod v2; pub mod v2;
// Check that we can safely cast a `usize` to a `u64`. // Check that we can safely cast a `usize` to a `u64`.

View File

@ -35,3 +35,10 @@ tokio = { version = "1.15", features = [ "rt-multi-thread", "time", "macros", "s
[build-dependencies] [build-dependencies]
prost-build = "0.11" prost-build = "0.11"
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -18,6 +18,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
pub use self::codec::{Cookie, ErrorCode, Namespace, NamespaceTooLong, Registration, Ttl}; pub use self::codec::{Cookie, ErrorCode, Namespace, NamespaceTooLong, Registration, Ttl};
mod codec; mod codec;

View File

@ -27,3 +27,10 @@ async-std = "1.6.2"
env_logger = "0.9.0" env_logger = "0.9.0"
libp2p = { path = "../..", features = ["full"] } libp2p = { path = "../..", features = ["full"] }
rand = "0.8" rand = "0.8"
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -56,6 +56,8 @@
//! advertised during inbound respectively outbound protocol negotiation //! advertised during inbound respectively outbound protocol negotiation
//! on the substreams. //! on the substreams.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
pub mod codec; pub mod codec;
pub mod handler; pub mod handler;

View File

@ -31,6 +31,7 @@
#![doc(html_logo_url = "https://libp2p.io/img/logo_small.png")] #![doc(html_logo_url = "https://libp2p.io/img/logo_small.png")]
#![doc(html_favicon_url = "https://libp2p.io/img/favicon.png")] #![doc(html_favicon_url = "https://libp2p.io/img/favicon.png")]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
pub use bytes; pub use bytes;
pub use futures; pub use futures;
@ -40,17 +41,14 @@ pub use libp2p_core::multihash;
pub use multiaddr; pub use multiaddr;
#[cfg(feature = "autonat")] #[cfg(feature = "autonat")]
#[cfg_attr(docsrs, doc(cfg(feature = "autonat")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_autonat as autonat; pub use libp2p_autonat as autonat;
#[doc(inline)] #[doc(inline)]
pub use libp2p_core as core; pub use libp2p_core as core;
#[cfg(feature = "dcutr")] #[cfg(feature = "dcutr")]
#[cfg_attr(docsrs, doc(cfg(feature = "dcutr")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_dcutr as dcutr; pub use libp2p_dcutr as dcutr;
#[cfg(feature = "deflate")] #[cfg(feature = "deflate")]
#[cfg_attr(docsrs, doc(cfg(feature = "deflate")))]
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))] #[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_deflate as deflate; pub use libp2p_deflate as deflate;
@ -60,20 +58,16 @@ pub use libp2p_deflate as deflate;
#[doc(inline)] #[doc(inline)]
pub use libp2p_dns as dns; pub use libp2p_dns as dns;
#[cfg(feature = "floodsub")] #[cfg(feature = "floodsub")]
#[cfg_attr(docsrs, doc(cfg(feature = "floodsub")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_floodsub as floodsub; pub use libp2p_floodsub as floodsub;
#[cfg(feature = "gossipsub")] #[cfg(feature = "gossipsub")]
#[cfg_attr(docsrs, doc(cfg(feature = "gossipsub")))]
#[cfg(not(target_os = "unknown"))] #[cfg(not(target_os = "unknown"))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_gossipsub as gossipsub; pub use libp2p_gossipsub as gossipsub;
#[cfg(feature = "identify")] #[cfg(feature = "identify")]
#[cfg_attr(docsrs, doc(cfg(feature = "identify")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_identify as identify; pub use libp2p_identify as identify;
#[cfg(feature = "kad")] #[cfg(feature = "kad")]
#[cfg_attr(docsrs, doc(cfg(feature = "kad")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_kad as kad; pub use libp2p_kad as kad;
#[cfg(feature = "mdns")] #[cfg(feature = "mdns")]
@ -82,39 +76,30 @@ pub use libp2p_kad as kad;
#[doc(inline)] #[doc(inline)]
pub use libp2p_mdns as mdns; pub use libp2p_mdns as mdns;
#[cfg(feature = "metrics")] #[cfg(feature = "metrics")]
#[cfg_attr(docsrs, doc(cfg(feature = "metrics")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_metrics as metrics; pub use libp2p_metrics as metrics;
#[cfg(feature = "mplex")] #[cfg(feature = "mplex")]
#[cfg_attr(docsrs, doc(cfg(feature = "mplex")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_mplex as mplex; pub use libp2p_mplex as mplex;
#[cfg(feature = "noise")] #[cfg(feature = "noise")]
#[cfg_attr(docsrs, doc(cfg(feature = "noise")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_noise as noise; pub use libp2p_noise as noise;
#[cfg(feature = "ping")] #[cfg(feature = "ping")]
#[cfg_attr(docsrs, doc(cfg(feature = "ping")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_ping as ping; pub use libp2p_ping as ping;
#[cfg(feature = "plaintext")] #[cfg(feature = "plaintext")]
#[cfg_attr(docsrs, doc(cfg(feature = "plaintext")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_plaintext as plaintext; pub use libp2p_plaintext as plaintext;
#[cfg(feature = "pnet")] #[cfg(feature = "pnet")]
#[cfg_attr(docsrs, doc(cfg(feature = "pnet")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_pnet as pnet; pub use libp2p_pnet as pnet;
#[cfg(feature = "relay")] #[cfg(feature = "relay")]
#[cfg_attr(docsrs, doc(cfg(feature = "relay")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_relay as relay; pub use libp2p_relay as relay;
#[cfg(feature = "rendezvous")] #[cfg(feature = "rendezvous")]
#[cfg_attr(docsrs, doc(cfg(feature = "rendezvous")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_rendezvous as rendezvous; pub use libp2p_rendezvous as rendezvous;
#[cfg(feature = "request-response")] #[cfg(feature = "request-response")]
#[cfg_attr(docsrs, doc(cfg(feature = "request-response")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_request_response as request_response; pub use libp2p_request_response as request_response;
#[doc(inline)] #[doc(inline)]
@ -129,20 +114,16 @@ pub use libp2p_tcp as tcp;
#[doc(inline)] #[doc(inline)]
pub use libp2p_tls as tls; pub use libp2p_tls as tls;
#[cfg(feature = "uds")] #[cfg(feature = "uds")]
#[cfg_attr(docsrs, doc(cfg(feature = "uds")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_uds as uds; pub use libp2p_uds as uds;
#[cfg(feature = "wasm-ext")] #[cfg(feature = "wasm-ext")]
#[cfg_attr(docsrs, doc(cfg(feature = "wasm-ext")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_wasm_ext as wasm_ext; pub use libp2p_wasm_ext as wasm_ext;
#[cfg(feature = "websocket")] #[cfg(feature = "websocket")]
#[cfg_attr(docsrs, doc(cfg(feature = "websocket")))]
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))] #[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_websocket as websocket; pub use libp2p_websocket as websocket;
#[cfg(feature = "yamux")] #[cfg(feature = "yamux")]
#[cfg_attr(docsrs, doc(cfg(feature = "yamux")))]
#[doc(inline)] #[doc(inline)]
pub use libp2p_yamux as yamux; pub use libp2p_yamux as yamux;
@ -188,20 +169,6 @@ pub use libp2p_swarm_derive::NetworkBehaviour;
feature = "mplex", feature = "mplex",
feature = "yamux" feature = "yamux"
))] ))]
#[cfg_attr(
docsrs,
doc(cfg(all(
not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")),
any(
all(feature = "tcp-async-io", feature = "dns-async-std"),
all(feature = "tcp", feature = "dns", feature = "async-std")
),
feature = "websocket",
feature = "noise",
feature = "mplex",
feature = "yamux"
)))
)]
#[cfg_attr( #[cfg_attr(
all( all(
any(feature = "tcp-async-io", feature = "dns-async-std"), any(feature = "tcp-async-io", feature = "dns-async-std"),
@ -262,20 +229,6 @@ pub async fn development_transport(
feature = "mplex", feature = "mplex",
feature = "yamux" feature = "yamux"
))] ))]
#[cfg_attr(
docsrs,
doc(cfg(all(
not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")),
any(
all(feature = "tcp-tokio", feature = "dns-tokio"),
all(feature = "tcp", feature = "dns", feature = "tokio")
),
feature = "websocket",
feature = "noise",
feature = "mplex",
feature = "yamux"
)))
)]
#[cfg_attr( #[cfg_attr(
all( all(
any(feature = "tcp-tokio", feature = "dns-tokio"), any(feature = "tcp-tokio", feature = "dns-tokio"),

View File

@ -23,3 +23,10 @@ libp2p = { path = "..", features = ["full"] }
either = "1.6.0" either = "1.6.0"
futures = "0.3.1" futures = "0.3.1"
void = "1" void = "1"
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -19,6 +19,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
#![recursion_limit = "256"] #![recursion_limit = "256"]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use heck::ToUpperCamelCase; use heck::ToUpperCamelCase;
use proc_macro::TokenStream; use proc_macro::TokenStream;

View File

@ -29,3 +29,10 @@ async-std = { version = "1.6.2", features = ["attributes"] }
env_logger = "0.9" env_logger = "0.9"
libp2p = { path = "..", features = ["full"] } libp2p = { path = "..", features = ["full"] }
quickcheck = { package = "quickcheck-ext", path = "../misc/quickcheck-ext" } quickcheck = { package = "quickcheck-ext", path = "../misc/quickcheck-ext" }
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -53,6 +53,8 @@
//! are supported, when to open a new outbound substream, etc. //! are supported, when to open a new outbound substream, etc.
//! //!
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
mod connection; mod connection;
mod registry; mod registry;
#[cfg(test)] #[cfg(test)]

View File

@ -20,3 +20,10 @@ async-std = "1.6.2"
libp2p = { path = "../..", features = ["full"] } libp2p = { path = "../..", features = ["full"] }
quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" } quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" }
rand = "0.8" rand = "0.8"
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -18,6 +18,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use futures::{prelude::*, ready}; use futures::{prelude::*, ready};
use libp2p_core::{InboundUpgrade, OutboundUpgrade, UpgradeInfo}; use libp2p_core::{InboundUpgrade, OutboundUpgrade, UpgradeInfo};
use std::{io, iter, pin::Pin, task::Context, task::Poll}; use std::{io, iter, pin::Pin, task::Context, task::Poll};

View File

@ -32,3 +32,10 @@ tokio = ["trust-dns-resolver/tokio-runtime"]
# available for `tokio`. # available for `tokio`.
tokio-dns-over-rustls = ["tokio", "trust-dns-resolver/dns-over-rustls"] tokio-dns-over-rustls = ["tokio", "trust-dns-resolver/dns-over-rustls"]
tokio-dns-over-https-rustls = ["tokio", "trust-dns-resolver/dns-over-https-rustls"] tokio-dns-over-https-rustls = ["tokio", "trust-dns-resolver/dns-over-https-rustls"]
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -54,6 +54,8 @@
//! //!
//![trust-dns-resolver]: https://docs.rs/trust-dns-resolver/latest/trust_dns_resolver/#dns-over-tls-and-dns-over-https //![trust-dns-resolver]: https://docs.rs/trust-dns-resolver/latest/trust_dns_resolver/#dns-over-tls-and-dns-over-https
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#[cfg(feature = "async-std")] #[cfg(feature = "async-std")]
use async_std_resolver::{AsyncStdConnection, AsyncStdConnectionProvider}; use async_std_resolver::{AsyncStdConnection, AsyncStdConnectionProvider};
use futures::{future::BoxFuture, prelude::*}; use futures::{future::BoxFuture, prelude::*};

View File

@ -38,3 +38,10 @@ ed25519-compact = "2.0.2"
[build-dependencies] [build-dependencies]
prost-build = "0.11" prost-build = "0.11"
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -53,6 +53,8 @@
//! //!
//! [noise]: http://noiseprotocol.org/ //! [noise]: http://noiseprotocol.org/
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
mod error; mod error;
mod io; mod io;
mod protocol; mod protocol;

View File

@ -27,3 +27,10 @@ rand = "0.8"
[build-dependencies] [build-dependencies]
prost-build = "0.11" prost-build = "0.11"
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -18,6 +18,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use crate::error::PlainTextError; use crate::error::PlainTextError;
use bytes::Bytes; use bytes::Bytes;

View File

@ -20,3 +20,10 @@ pin-project = "1.0.2"
[dev-dependencies] [dev-dependencies]
quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" } quickcheck = { package = "quickcheck-ext", path = "../../misc/quickcheck-ext" }
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -23,6 +23,9 @@
//! //!
//! Libp2p nodes configured with a pre-shared key can only communicate with other nodes with //! Libp2p nodes configured with a pre-shared key can only communicate with other nodes with
//! the same key. //! the same key.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
mod crypt_writer; mod crypt_writer;
use crypt_writer::CryptWriter; use crypt_writer::CryptWriter;
use futures::prelude::*; use futures::prelude::*;

View File

@ -29,3 +29,10 @@ async-io = ["async-io-crate"]
async-std = { version = "1.6.5", features = ["attributes"] } async-std = { version = "1.6.5", features = ["attributes"] }
tokio-crate = { package = "tokio", version = "1.0.1", default-features = false, features = ["net", "rt", "macros"] } tokio-crate = { package = "tokio", version = "1.0.1", default-features = false, features = ["net", "rt", "macros"] }
env_logger = "0.9.0" env_logger = "0.9.0"
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -26,6 +26,8 @@
//! the enabled features, which implement the `Transport` trait for use as a //! the enabled features, which implement the `Transport` trait for use as a
//! transport with `libp2p-core` or `libp2p-swarm`. //! transport with `libp2p-core` or `libp2p-swarm`.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
mod provider; mod provider;
use if_watch::{IfEvent, IfWatcher}; use if_watch::{IfEvent, IfWatcher};

View File

@ -19,3 +19,10 @@ tokio = { version = "1.15", default-features = false, features = ["net"], option
[target.'cfg(all(unix, not(target_os = "emscripten")))'.dev-dependencies] [target.'cfg(all(unix, not(target_os = "emscripten")))'.dev-dependencies]
tempfile = "3.0" tempfile = "3.0"
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -36,7 +36,7 @@
not(target_os = "emscripten"), not(target_os = "emscripten"),
any(feature = "tokio", feature = "async-std") any(feature = "tokio", feature = "async-std")
))] ))]
#![cfg_attr(docsrs, doc(cfg(all(unix, not(target_os = "emscripten")))))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use futures::stream::BoxStream; use futures::stream::BoxStream;
use futures::{ use futures::{
@ -66,7 +66,6 @@ pub type Listener<T> = BoxStream<
macro_rules! codegen { macro_rules! codegen {
($feature_name:expr, $uds_config:ident, $build_listener:expr, $unix_stream:ty, $($mut_or_not:tt)*) => { ($feature_name:expr, $uds_config:ident, $build_listener:expr, $unix_stream:ty, $($mut_or_not:tt)*) => {
/// Represents the configuration for a Unix domain sockets transport capability for libp2p. /// Represents the configuration for a Unix domain sockets transport capability for libp2p.
#[cfg_attr(docsrs, doc(cfg(feature = $feature_name)))]
pub struct $uds_config { pub struct $uds_config {
listeners: VecDeque<(ListenerId, Listener<Self>)>, listeners: VecDeque<(ListenerId, Listener<Self>)>,
} }

View File

@ -20,3 +20,10 @@ wasm-bindgen-futures = "0.4.4"
[features] [features]
websocket = [] websocket = []
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -32,6 +32,8 @@
//! module. //! module.
//! //!
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use futures::{future::Ready, prelude::*, ready, stream::SelectAll}; use futures::{future::Ready, prelude::*, ready, stream::SelectAll};
use libp2p_core::{ use libp2p_core::{
connection::Endpoint, connection::Endpoint,

View File

@ -25,3 +25,10 @@ webpki-roots = "0.22"
[dev-dependencies] [dev-dependencies]
libp2p = { path = "../..", features = ["full"] } libp2p = { path = "../..", features = ["full"] }
# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustc-args = ["--cfg", "docsrs"]

View File

@ -20,6 +20,8 @@
//! Implementation of the libp2p `Transport` trait for Websockets. //! Implementation of the libp2p `Transport` trait for Websockets.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
pub mod error; pub mod error;
pub mod framed; pub mod framed;
pub mod tls; pub mod tls;