Skip to content

Commit 35b43c0

Browse files
committed
Add union feature to documentation
1 parent 4f968c9 commit 35b43c0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@
1414
//!
1515
//! To depend on `smallvec` without `libstd`, use `default-features = false` in the `smallvec`
1616
//! section of Cargo.toml to disable its `"std"` feature.
17+
//!
18+
//! ## `union` feature
19+
//!
20+
//! When the `union` feature is enabled `smallvec` will track its state (inline or spilled)
21+
//! without the use of an enum tag, reducing the size of the `smallvec` by one machine word.
22+
//! This means that there is potentially no space overhead compared to `Vec`.
23+
//! Note that `smallvec` can still be larger than `Vec` if the inline buffer is larger than two
24+
//! machine words.
25+
//!
26+
//! To use this feature add `features = ["union"]` in the `smallvec` section of Cargo.toml.
27+
//! Note that this feature requires a nightly compiler (for now).
1728
1829
#![cfg_attr(not(feature = "std"), no_std)]
1930
#![cfg_attr(not(feature = "std"), feature(alloc))]

0 commit comments

Comments
 (0)