Skip to content

Commit 6a14df0

Browse files
committed
Document Cargo features
1 parent c48902f commit 6a14df0

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

lib.rs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,16 @@
1414
//! `write` feature implements the `std::io::Write` trait for vectors of `u8`.
1515
//! When this feature is enabled, `smallvec` depends on `std`.
1616
//!
17-
//! ## `union` feature
17+
//! ## Optional features
18+
//!
19+
//! ### `write`
20+
//!
21+
//! When this feature is enabled, `SmallVec<[u8; _]>` implements the `std::io::Write` trait.
22+
//! This feature is not compatible with `#![no_std]` programs.
23+
//!
24+
//! ### `union`
25+
//!
26+
//! **This feature is unstable and requires a nightly build of the Rust toolchain.**
1827
//!
1928
//! When the `union` feature is enabled `smallvec` will track its state (inline or spilled)
2029
//! without the use of an enum tag, reducing the size of the `smallvec` by one machine word.
@@ -24,6 +33,29 @@
2433
//!
2534
//! To use this feature add `features = ["union"]` in the `smallvec` section of Cargo.toml.
2635
//! Note that this feature requires a nightly compiler (for now).
36+
//!
37+
//! ### `const_generics`
38+
//!
39+
//! **This feature is unstable and requires a nightly build of the Rust toolchain.**
40+
//!
41+
//! When this feature is enabled, `SmallVec` works with any arrays of any size, not just a fixed
42+
//! list of sizes.
43+
//!
44+
//! ### `specialization`
45+
//!
46+
//! **This feature is unstable and requires a nightly build of the Rust toolchain.**
47+
//!
48+
//! When this feature is enabled, `SmallVec::from(slice)` has improved performance for slices
49+
//! of `Copy` types. (Without this feature, you can use `SmallVec::from_slice` to get optimal
50+
//! performance for `Copy` types.)
51+
//!
52+
//! ### `may_dangle`
53+
//!
54+
//! **This feature is unstable and requires a nightly build of the Rust toolchain.**
55+
//!
56+
//! This feature makes the Rust compiler less strict about use of vectors that contain borrowed
57+
//! references. For details, see the
58+
//! [Rustonomicon](https://doc.rust-lang.org/1.42.0/nomicon/dropck.html#an-escape-hatch).
2759
2860
#![no_std]
2961
#![cfg_attr(feature = "union", feature(untagged_unions))]

0 commit comments

Comments
 (0)