Skip to content

Commit 3957cd8

Browse files
authored
Auto merge of #207 - mbrubeck:bump, r=mbrubeck
Version 1.3.0 * Add a new unstable `const_generics` feature (#204). * Improve inlining of constructor functions (#206). * Add a `slice.to_smallvec()` convenience method (#203). * Documentation and testing improvements.
2 parents faca460 + 851d222 commit 3957cd8

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "smallvec"
3-
version = "1.2.0"
3+
version = "1.3.0"
44
edition = "2018"
55
authors = ["Simon Sapin <[email protected]>"]
66
license = "MIT/Apache-2.0"

lib.rs

Lines changed: 36 additions & 2 deletions
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))]
@@ -1697,7 +1729,9 @@ impl_array!(
16971729
0x40000, 0x60000, 0x80000, 0x10_0000
16981730
);
16991731

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.
17011735
fn to_smallvec(&self) -> SmallVec<A>;
17021736
}
17031737

0 commit comments

Comments
 (0)