🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

arrayvec

Package Overview
Dependencies
Maintainers
0
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arrayvec - cargo Package Compare versions

Comparing version
0.3.18
to
0.3.19
+23
tests/generic_array.rs
#![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]);
}
+2
-1

@@ -8,2 +8,3 @@ language: rust

env:
- FEATURES="use_generic_array"
- NODEFAULT=1

@@ -19,3 +20,3 @@ - rust: beta

env:
- FEATURES='use_union'
- FEATURES='use_union use_generic_array'
- NODROP_FEATURES='use_union'

@@ -22,0 +23,0 @@ branches:

[package]
name = "arrayvec"
version = "0.3.18"
version = "0.3.19"
authors = ["bluss"]

@@ -22,2 +22,6 @@ license = "MIT/Apache-2.0"

[dependencies.generic-array]
version = "0.5.1"
optional = true
[features]

@@ -27,1 +31,2 @@ default = ["std"]

use_union = ["nodrop/use_union"]
use_generic_array = ["generic-array"]

@@ -9,3 +9,3 @@

__ http://bluss.github.io/arrayvec
__ https://bluss.github.io/arrayvec

@@ -26,2 +26,8 @@ |build_status|_ |crates|_ |crates2|_

- 0.3.19
- Add new crate feature ``use_generic_array`` which allows using their
``GenericArray`` just like a regular fixed size array for the storage
of an ``ArrayVec``.
- 0.3.18

@@ -28,0 +34,0 @@

@@ -22,2 +22,20 @@

#[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 {

@@ -37,2 +55,9 @@ #[inline(always)]

impl Index for usize {
#[inline(always)]
fn to_usize(self) -> usize { self }
#[inline(always)]
fn from(ix: usize) -> Self { ix }
}
macro_rules! fix_array_impl {

@@ -39,0 +64,0 @@ ($index_type:ty, $len:expr ) => (

@@ -16,2 +16,8 @@ //! **arrayvec** provides the types `ArrayVec` and `ArrayString`:

//! 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.
#![cfg_attr(not(feature="std"), no_std)]

@@ -21,2 +27,5 @@ extern crate odds;

#[cfg(feature = "use_generic_array")]
extern crate generic_array;
#[cfg(not(feature="std"))]

@@ -23,0 +32,0 @@ extern crate core as std;