Make docsrs show items for all features

with indicators what needs to be enabled to use each conditional item
This commit is contained in:
Jonas Platte 2020-04-17 14:01:57 +02:00
parent ccaffcf107
commit 8f9bcd3a65
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
6 changed files with 10 additions and 0 deletions

View File

@ -12,6 +12,10 @@ repository = "https://github.com/ruma/ruma-identifiers"
version = "0.14.1"
edition = "2018"
[package.metadata.docs.rs]
features = ["all"]
rustdoc-args = ["--cfg", "docsrs"]
[features]
default = ["serde"]

View File

@ -11,6 +11,7 @@ pub type DeviceId = String;
/// Generates a random `DeviceId`, suitable for assignment to a new device.
#[cfg(feature = "rand")]
#[cfg_attr(docsrs, doc(cfg(feature = "rand")))]
pub fn generate() -> DeviceId {
generate_localpart(8)
}

View File

@ -56,6 +56,7 @@ impl EventId {
/// Does not currently ever fail, but may fail in the future if the homeserver cannot be parsed
/// parsed as a valid host.
#[cfg(feature = "rand")]
#[cfg_attr(docsrs, doc(cfg(feature = "rand")))]
pub fn new(server_name: &str) -> Result<Self, Error> {
use crate::{generate_localpart, is_valid_server_name};

View File

@ -9,6 +9,7 @@
)]
// Since we support Rust 1.36.0, we can't apply this suggestion yet
#![allow(clippy::use_self)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#[cfg(feature = "diesel")]
#[cfg_attr(feature = "diesel", macro_use)]
@ -31,6 +32,7 @@ mod macros;
pub mod device_id;
#[cfg(feature = "diesel")]
#[cfg_attr(docsrs, doc(cfg(feature = "diesel")))]
mod diesel_integration;
mod error;
mod event_id;

View File

@ -34,6 +34,7 @@ impl RoomId {
///
/// Fails if the given homeserver cannot be parsed as a valid host.
#[cfg(feature = "rand")]
#[cfg_attr(docsrs, doc(cfg(feature = "rand")))]
pub fn new(server_name: &str) -> Result<Self, Error> {
use crate::{generate_localpart, is_valid_server_name};

View File

@ -40,6 +40,7 @@ impl UserId {
///
/// Fails if the given homeserver cannot be parsed as a valid host.
#[cfg(feature = "rand")]
#[cfg_attr(docsrs, doc(cfg(feature = "rand")))]
pub fn new(server_name: &str) -> Result<Self, Error> {
use crate::generate_localpart;