Skip to content

Commit 34d7b8d

Browse files
author
bors-servo
authored
Auto merge of #193 - mbrubeck:bump, r=emilio
Version 1.1.0 Changes in this release: * Added new method `SmallVec::into_boxed_slice` (#190). * Added new methods `IntoIter::as_slice` and `as_mut_slice` (#182). * `IntoIter` now implements `Clone` (#192). * Improved documentation and testing (#186, #189). * Minor code cleanups (#176). Also added a simple example to the README.
2 parents 941d6aa + 436dedb commit 34d7b8d

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
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.0.0"
3+
version = "1.1.0"
44
edition = "2018"
55
authors = ["Simon Sapin <[email protected]>"]
66
license = "MIT/Apache-2.0"

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,21 @@ rust-smallvec
66
[Release notes](https://github.com/servo/rust-smallvec/releases)
77

88
"Small vector" optimization for Rust: store up to a small number of items on the stack
9+
10+
## Example
11+
12+
```rust
13+
use smallvec::{SmallVec, smallvec};
14+
15+
// This SmallVec can hold up to 4 items on the stack:
16+
let mut v: SmallVec<[i32; 4]> = smallvec![1, 2, 3, 4];
17+
18+
// It will automatically move its contents to the heap if
19+
// contains more than four items:
20+
v.push(5);
21+
22+
// SmallVec points to a slice, so you can use normal slice
23+
// indexing and other methods to access its contents:
24+
v[0] = v[1] + v[2];
25+
v.sort();
26+
```

0 commit comments

Comments
 (0)