From 9db51c3194232c944769ac3aca5e698de8397e79 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Fri, 8 Sep 2017 10:34:24 +0200 Subject: [PATCH] The collections crate was merged into the alloc crate --- .travis.yml | 6 +----- Cargo.toml | 1 - README.md | 7 +------ src/lib.rs | 3 --- src/object.rs | 6 +++--- src/slice.rs | 18 +++++++++--------- 6 files changed, 14 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index e508ea5..45dbde1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,11 +10,7 @@ matrix: - rust: nightly env: FEATURES='alloc' - rust: nightly - env: FEATURES='collections' - - rust: nightly - env: FEATURES='alloc collections' - - rust: nightly - env: FEATURES='std alloc collections' + env: FEATURES='std alloc' script: - cargo build --no-default-features --features "$FEATURES" notifications: diff --git a/Cargo.toml b/Cargo.toml index 2562c18..9c368b8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,5 +14,4 @@ license = "0BSD" [features] std = [] alloc = [] -collections = [] default = ["std"] diff --git a/README.md b/README.md index 29aab29..51c23c7 100644 --- a/README.md +++ b/README.md @@ -72,14 +72,9 @@ The `std` feature enables use of `Box` and `Vec` through a dependency on the `st ### Feature `alloc` -The `alloc` feature enables use of `Box` through a dependency on the `alloc` crate. +The `alloc` feature enables use of `Box` and `Vec` through a dependency on the `alloc` crate. This only works on nightly rustc. -### Feature `collections` - -The `collections` feature enables use of `Vec` through a dependency on -the `collections` crate. This only works on nightly rustc. - Usage ----- diff --git a/src/lib.rs b/src/lib.rs index dc82a34..272bcce 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,5 @@ #![no_std] #![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))] -#![cfg_attr(all(feature = "collections", not(feature = "std")), feature(collections))] //! A library that provides a way to logically own objects, whether or not //! heap allocation is available. @@ -9,8 +8,6 @@ extern crate std; #[cfg(all(feature = "alloc", not(feature = "std")))] extern crate alloc; -#[cfg(all(feature = "collections", not(feature = "std")))] -extern crate collections; mod object; mod slice; diff --git a/src/object.rs b/src/object.rs index c051247..3222236 100644 --- a/src/object.rs +++ b/src/object.rs @@ -7,8 +7,8 @@ use std::boxed::Box; use alloc::boxed::Box; #[cfg(feature = "std")] use std::vec::Vec; -#[cfg(all(feature = "alloc", feature = "collections", not(feature = "std")))] -use collections::vec::Vec; +#[cfg(all(feature = "alloc", not(feature = "std")))] +use alloc::vec::Vec; /// A managed object. /// @@ -61,7 +61,7 @@ impl From> for Managed<'static, T> { } } -#[cfg(any(feature = "std", all(feature = "alloc", feature = "collections")))] +#[cfg(any(feature = "std", feature = "alloc"))] impl From> for Managed<'static, [T]> { fn from(value: Vec) -> Self { Managed::Owned(value.into_boxed_slice()) diff --git a/src/slice.rs b/src/slice.rs index 6e2b506..897ef1a 100644 --- a/src/slice.rs +++ b/src/slice.rs @@ -7,8 +7,8 @@ use std::boxed::Box; use alloc::boxed::Box; #[cfg(feature = "std")] use std::vec::Vec; -#[cfg(all(feature = "collections", not(feature = "std")))] -use collections::vec::Vec; +#[cfg(all(feature = "alloc", not(feature = "std")))] +use alloc::vec::Vec; /// A managed slice. /// @@ -29,8 +29,8 @@ use collections::vec::Vec; pub enum ManagedSlice<'a, T: 'a> { /// Borrowed variant. Borrowed(&'a mut [T]), - /// Owned variant, only available with the `std` or `collections` feature enabled. - #[cfg(any(feature = "std", feature = "collections"))] + /// Owned variant, only available with the `std` or `alloc` feature enabled. + #[cfg(any(feature = "std", feature = "alloc"))] Owned(Vec) } @@ -39,7 +39,7 @@ impl<'a, T: 'a> fmt::Debug for ManagedSlice<'a, T> fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { &ManagedSlice::Borrowed(ref x) => write!(f, "Borrowed({:?})", x), - #[cfg(any(feature = "std", feature = "collections"))] + #[cfg(any(feature = "std", feature = "alloc"))] &ManagedSlice::Owned(ref x) => write!(f, "Owned({:?})", x) } @@ -67,11 +67,11 @@ macro_rules! from_unboxed_slice { ) } -#[cfg(any(feature = "std", all(feature = "alloc", feature = "collections")))] +#[cfg(any(feature = "std", feature = "alloc"))] from_unboxed_slice!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31); -#[cfg(any(feature = "std", feature = "collections"))] +#[cfg(any(feature = "std", feature = "alloc"))] impl From> for ManagedSlice<'static, T> { fn from(value: Vec) -> Self { ManagedSlice::Owned(value) @@ -84,7 +84,7 @@ impl<'a, T: 'a> Deref for ManagedSlice<'a, T> { fn deref(&self) -> &Self::Target { match self { &ManagedSlice::Borrowed(ref value) => value, - #[cfg(any(feature = "std", feature = "collections"))] + #[cfg(any(feature = "std", feature = "alloc"))] &ManagedSlice::Owned(ref value) => value } } @@ -94,7 +94,7 @@ impl<'a, T: 'a> DerefMut for ManagedSlice<'a, T> { fn deref_mut(&mut self) -> &mut Self::Target { match self { &mut ManagedSlice::Borrowed(ref mut value) => value, - #[cfg(any(feature = "std", feature = "collections"))] + #[cfg(any(feature = "std", feature = "alloc"))] &mut ManagedSlice::Owned(ref mut value) => value } }