|
14 | 14 | //! `write` feature implements the `std::io::Write` trait for vectors of `u8`.
|
15 | 15 | //! When this feature is enabled, `smallvec` depends on `std`.
|
16 | 16 | //!
|
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.** |
18 | 27 | //!
|
19 | 28 | //! When the `union` feature is enabled `smallvec` will track its state (inline or spilled)
|
20 | 29 | //! without the use of an enum tag, reducing the size of the `smallvec` by one machine word.
|
|
24 | 33 | //!
|
25 | 34 | //! To use this feature add `features = ["union"]` in the `smallvec` section of Cargo.toml.
|
26 | 35 | //! 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). |
27 | 59 |
|
28 | 60 | #![no_std]
|
29 | 61 | #![cfg_attr(feature = "union", feature(untagged_unions))]
|
@@ -1697,7 +1729,9 @@ impl_array!(
|
1697 | 1729 | 0x40000, 0x60000, 0x80000, 0x10_0000
|
1698 | 1730 | );
|
1699 | 1731 |
|
1700 |
| -trait ToSmallVec<A:Array> { |
| 1732 | +/// Convenience trait for constructing a `SmallVec` |
| 1733 | +pub trait ToSmallVec<A:Array> { |
| 1734 | + /// Construct a new `SmallVec` from a slice. |
1701 | 1735 | fn to_smallvec(&self) -> SmallVec<A>;
|
1702 | 1736 | }
|
1703 | 1737 |
|
|
0 commit comments