Remove the optional generic-array feature
- It can be added back later if needed - A public dependency implies version coupling, and we can't afford to have it for a niche use case.
This commit is contained in:
+1
-2
@@ -5,7 +5,6 @@ matrix:
|
|||||||
- rust: 1.12.0
|
- rust: 1.12.0
|
||||||
- rust: stable
|
- rust: stable
|
||||||
env:
|
env:
|
||||||
- FEATURES="use_generic_array"
|
|
||||||
- NODEFAULT=1
|
- NODEFAULT=1
|
||||||
- rust: beta
|
- rust: beta
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
@@ -16,7 +15,7 @@ matrix:
|
|||||||
- NODROP_FEATURES='use_needs_drop'
|
- NODROP_FEATURES='use_needs_drop'
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
env:
|
env:
|
||||||
- FEATURES='use_union use_generic_array'
|
- FEATURES='use_union'
|
||||||
- NODROP_FEATURES='use_union'
|
- NODROP_FEATURES='use_union'
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
|
|||||||
@@ -19,12 +19,7 @@ version = "0.1.8"
|
|||||||
path = "nodrop"
|
path = "nodrop"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
[dependencies.generic-array]
|
|
||||||
version = "0.5.1"
|
|
||||||
optional = true
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
std = ["odds/std", "nodrop/std"]
|
std = ["odds/std", "nodrop/std"]
|
||||||
use_union = ["nodrop/use_union"]
|
use_union = ["nodrop/use_union"]
|
||||||
use_generic_array = ["generic-array"]
|
|
||||||
|
|||||||
@@ -32,24 +32,6 @@ pub trait ArrayExt : Array {
|
|||||||
|
|
||||||
impl<A> ArrayExt for A where A: Array { }
|
impl<A> ArrayExt for A where A: Array { }
|
||||||
|
|
||||||
#[cfg(feature = "use_generic_array")]
|
|
||||||
unsafe impl<T, U> Array for ::generic_array::GenericArray<T, U>
|
|
||||||
where U: ::generic_array::ArrayLength<T>
|
|
||||||
{
|
|
||||||
type Item = T;
|
|
||||||
type Index = usize;
|
|
||||||
fn as_ptr(&self) -> *const Self::Item {
|
|
||||||
(**self).as_ptr()
|
|
||||||
}
|
|
||||||
fn as_mut_ptr(&mut self) -> *mut Self::Item {
|
|
||||||
(**self).as_mut_ptr()
|
|
||||||
}
|
|
||||||
fn capacity() -> usize {
|
|
||||||
U::to_usize()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Index for u8 {
|
impl Index for u8 {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn to_usize(self) -> usize { self as usize }
|
fn to_usize(self) -> usize { self as usize }
|
||||||
|
|||||||
@@ -14,19 +14,11 @@
|
|||||||
//! - Use the unstable feature untagged unions for the internal implementation,
|
//! - Use the unstable feature untagged unions for the internal implementation,
|
||||||
//! which has reduced space overhead
|
//! which has reduced space overhead
|
||||||
//!
|
//!
|
||||||
//! - `use_generic_array`
|
|
||||||
//! - Optional
|
|
||||||
//! - Requires Rust stable channel
|
|
||||||
//! - Depend on generic-array and allow using it just like a fixed
|
|
||||||
//! size array for ArrayVec storage.
|
|
||||||
#![doc(html_root_url="https://docs.rs/arrayvec/0.3/")]
|
#![doc(html_root_url="https://docs.rs/arrayvec/0.3/")]
|
||||||
#![cfg_attr(not(feature="std"), no_std)]
|
#![cfg_attr(not(feature="std"), no_std)]
|
||||||
extern crate odds;
|
extern crate odds;
|
||||||
extern crate nodrop;
|
extern crate nodrop;
|
||||||
|
|
||||||
#[cfg(feature = "use_generic_array")]
|
|
||||||
extern crate generic_array;
|
|
||||||
|
|
||||||
#[cfg(not(feature="std"))]
|
#[cfg(not(feature="std"))]
|
||||||
extern crate core as std;
|
extern crate core as std;
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
#![cfg(feature = "use_generic_array")]
|
|
||||||
|
|
||||||
extern crate arrayvec;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate generic_array;
|
|
||||||
|
|
||||||
use arrayvec::ArrayVec;
|
|
||||||
|
|
||||||
use generic_array::GenericArray;
|
|
||||||
|
|
||||||
use generic_array::typenum::U41;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_simple() {
|
|
||||||
let mut vec: ArrayVec<GenericArray<i32, U41>> = ArrayVec::new();
|
|
||||||
|
|
||||||
assert_eq!(vec.len(), 0);
|
|
||||||
assert_eq!(vec.capacity(), 41);
|
|
||||||
vec.extend(0..20);
|
|
||||||
assert_eq!(vec.len(), 20);
|
|
||||||
assert_eq!(&vec[..5], &[0, 1, 2, 3, 4]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user