Skip to content

Commit

Permalink
Document into_bits on docs.rs; use doc_cfg tags (#336)
Browse files Browse the repository at this point in the history
* Use doc_cfg to tag into_bits feature

* Configure docs.rs builds to use into_bits feature and doc_cfg
  • Loading branch information
dhardy committed Jul 28, 2023
1 parent 8b5a04f commit 76932d4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ license = "MIT OR Apache-2.0"
build = "build.rs"
edition = "2018"

[package.metadata.docs.rs]
features = ["into_bits"]
rustdoc-args = ["--cfg", "doc_cfg"]
# To build locally:
# RUSTDOCFLAGS="--cfg doc_cfg" cargo +nightly doc --features into_bits --no-deps --open

[badges]
appveyor = { repository = "rust-lang/packed_simd" }
travis-ci = { repository = "rust-lang/packed_simd" }
Expand Down
2 changes: 2 additions & 0 deletions src/api/into_bits.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
//! Implementation of `FromBits` and `IntoBits`.

/// Safe lossless bitwise conversion from `T` to `Self`.
#[cfg_attr(doc_cfg, doc(cfg(feature = "into_bits")))]
pub trait FromBits<T>: crate::marker::Sized {
/// Safe lossless bitwise transmute from `T` to `Self`.
fn from_bits(t: T) -> Self;
}

/// Safe lossless bitwise conversion from `Self` to `T`.
#[cfg_attr(doc_cfg, doc(cfg(feature = "into_bits")))]
pub trait IntoBits<T>: crate::marker::Sized {
/// Safe lossless bitwise transmute from `self` to `T`.
fn into_bits(self) -> T;
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@
clippy::from_over_into,
)]
#![cfg_attr(test, feature(hashmap_internals))]
#![cfg_attr(doc_cfg, feature(doc_cfg))]
#![deny(rust_2018_idioms, clippy::missing_inline_in_public_items)]
#![no_std]

Expand Down

0 comments on commit 76932d4

Please sign in to comment.