+10
-10
@@ -15,3 +15,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| name = "arrayvec" | ||
| version = "0.4.3" | ||
| version = "0.4.4" | ||
| authors = ["bluss"] | ||
@@ -33,4 +33,4 @@ description = "A vector with fixed capacity, backed by an array (it can be stored on the stack too). Implements fixed capacity ArrayVec and ArrayString." | ||
| harness = false | ||
| [dependencies.odds] | ||
| version = "0.2.23" | ||
| [dependencies.nodrop] | ||
| version = "0.1.8" | ||
| default-features = false | ||
@@ -43,5 +43,8 @@ | ||
| [dependencies.nodrop] | ||
| version = "0.1.8" | ||
| [dependencies.odds] | ||
| version = "0.2.23" | ||
| default-features = false | ||
| [dev-dependencies.bencher] | ||
| version = "0.1.4" | ||
| [dev-dependencies.matches] | ||
@@ -53,9 +56,6 @@ version = "0.1" | ||
| [dev-dependencies.bencher] | ||
| version = "0.1.4" | ||
| [features] | ||
| use_union = [] | ||
| default = ["std"] | ||
| std = [] | ||
| serde-1 = ["serde"] | ||
| default = ["std"] | ||
| use_union = [] |
+4
-0
@@ -25,2 +25,6 @@ | ||
| - 0.4.4 | ||
| - Add method ``ArrayVec::truncate()`` by @niklasf | ||
| - 0.4.3 | ||
@@ -27,0 +31,0 @@ |
@@ -34,2 +34,3 @@ use std::borrow::Borrow; | ||
| impl<A: Array<Item=u8>> Default for ArrayString<A> { | ||
| /// Return an empty `ArrayString` | ||
| fn default() -> ArrayString<A> { | ||
@@ -36,0 +37,0 @@ ArrayString::new() |
+20
-0
@@ -445,2 +445,21 @@ //! **arrayvec** provides the types `ArrayVec` and `ArrayString`: | ||
| /// Shortens the vector, keeping the first `len` elements and dropping | ||
| /// the rest. | ||
| /// | ||
| /// If `len` is greater than the vector's current length this has no | ||
| /// effect. | ||
| /// | ||
| /// ``` | ||
| /// use arrayvec::ArrayVec; | ||
| /// | ||
| /// let mut array = ArrayVec::from([1, 2, 3, 4, 5]); | ||
| /// array.truncate(3); | ||
| /// assert_eq!(&array[..], &[1, 2, 3]); | ||
| /// array.truncate(4); | ||
| /// assert_eq!(&array[..], &[1, 2, 3]); | ||
| /// ``` | ||
| pub fn truncate(&mut self, len: usize) { | ||
| while self.len() > len { self.pop(); } | ||
| } | ||
| /// Remove all elements in the vector. | ||
@@ -946,2 +965,3 @@ pub fn clear(&mut self) { | ||
| impl<A: Array> Default for ArrayVec<A> { | ||
| /// Return an empty array | ||
| fn default() -> ArrayVec<A> { | ||
@@ -948,0 +968,0 @@ ArrayVec::new() |
Sorry, the diff of this file is not supported yet