diff --git a/Cargo.toml b/Cargo.toml index 20daf2a..d644ebc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,9 @@ homepage = "https://github.com/enarx/flagset" documentation = "https://docs.rs/flagset" description = "Data types and a macro for generating enumeration-based bit flags" +[features] +std = [] + [dependencies.serde] version = "1.0" optional = true @@ -26,3 +29,4 @@ version = "0.1" [package.metadata.docs.rs] all-features = true +rustdoc-args = ["--cfg", "docsrs"] diff --git a/src/lib.rs b/src/lib.rs index c44b04b..273f238 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -245,7 +245,8 @@ appropriate `repr` attribute: )] #![allow(unknown_lints)] #![warn(clippy::all)] -#![no_std] +#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] use core::fmt::{Debug, Formatter, Result}; use core::ops::*; @@ -276,6 +277,9 @@ impl core::fmt::Display for InvalidBits { } } +#[cfg(feature = "std")] +impl std::error::Error for InvalidBits {} + #[doc(hidden)] pub trait Flags: Copy