зеркало из https://github.com/mozilla/gecko-dev.git
No bug - Revendor rust dependencies
This commit is contained in:
Родитель
a927a3f53f
Коммит
92eb546f04
|
@ -1 +0,0 @@
|
|||
{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".travis.yml":"6ef3b45cd0e38b989c77b44ec569f3028d75e9fd804a567deb5e471413436547","Cargo.toml":"6ee2958e4b76d84a3007e5e2add2339488f5e70e96f8726772f9c32112e022c9","LICENSE":"6c5c8b27da74e0dd71048d7f9cc4a4ad230767caa7afa46bc97b7b7443570930","README.md":"f7bfcc3ff3adb1b77112512bb5b3d18a40152549205d7b28783f443f504826e2","src/array.rs":"dca08b8c759bc24a2e53c0d14e86313d6f7500ec3b80b1e8534a400857b87e76","src/lib.rs":"18ca673af87ab41212dd785a0c8c7f2c362ac16e649d2636ba72d7c149911243"},"package":"96e774cadb24c2245225280c6799793f9802b918a58a79615e9490607489a717"}
|
|
@ -1,55 +0,0 @@
|
|||
language: rust
|
||||
|
||||
sudo: required
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- rust: 1.15.0
|
||||
- rust: stable
|
||||
- rust: beta
|
||||
- rust: nightly
|
||||
env:
|
||||
- NIGHTLY=1
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
script:
|
||||
- |
|
||||
cargo test --verbose &&
|
||||
cargo test --verbose --no-default-features &&
|
||||
cargo test --verbose --features "use_generic_array" &&
|
||||
cargo test --verbose --no-default-features --features "use_generic_array" &&
|
||||
([ "$NIGHTLY" != 1 ] || cargo test --verbose --features "use_union") &&
|
||||
([ "$NIGHTLY" != 1 ] || cargo test --verbose --features "use_union use_generic_array") &&
|
||||
([ "$NIGHTLY" != 1 ] || cargo test --verbose --no-default-features --features "use_union") &&
|
||||
([ "$NIGHTLY" != 1 ] || cargo test --verbose --no-default-features --features "use_union use_generic_array")
|
||||
|
||||
before_install:
|
||||
- sudo apt-get update
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libcurl4-openssl-dev
|
||||
- libelf-dev
|
||||
- libdw-dev
|
||||
- cmake
|
||||
- gcc
|
||||
- binutils-dev
|
||||
|
||||
after_success: |
|
||||
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz &&
|
||||
tar xzf master.tar.gz &&
|
||||
cd kcov-master &&
|
||||
mkdir build &&
|
||||
cd build &&
|
||||
cmake .. &&
|
||||
make &&
|
||||
sudo make install &&
|
||||
cd ../.. &&
|
||||
rm -rf kcov-master &&
|
||||
for file in target/debug/arraydeque-*; do mkdir -p "target/cov/$(basename $file)"; kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file"; done &&
|
||||
bash <(curl -s https://codecov.io/bash) &&
|
||||
echo "Uploaded code coverage"
|
|
@ -1,39 +0,0 @@
|
|||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g. crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
|
||||
[package]
|
||||
name = "arraydeque"
|
||||
version = "0.2.3"
|
||||
authors = ["goandylok"]
|
||||
description = "A ring buffer with a fixed capacity, can be stored on the stack."
|
||||
homepage = "https://github.com/goandylok/arraydeque"
|
||||
documentation = "https://docs.rs/arraydeque"
|
||||
keywords = ["ring", "circular", "stack", "array", "no_std"]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/goandylok/arraydeque"
|
||||
[dependencies.nodrop]
|
||||
version = "0.1.8"
|
||||
default-features = false
|
||||
|
||||
[dependencies.odds]
|
||||
version = "0.2.12"
|
||||
default-features = false
|
||||
|
||||
[dependencies.generic-array]
|
||||
version = "0.5.1"
|
||||
optional = true
|
||||
|
||||
[features]
|
||||
use_generic_array = ["generic-array"]
|
||||
use_union = ["nodrop/use_union"]
|
||||
default = ["std"]
|
||||
std = ["odds/std", "nodrop/std"]
|
|
@ -1,21 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 goandylok
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,197 +0,0 @@
|
|||
# `arraydeque`
|
||||
|
||||
[![build status](https://travis-ci.org/goandylok/arraydeque.svg?branch=master)](https://travis-ci.org/goandylok/arraydeque)
|
||||
[![codecov](https://codecov.io/gh/goandylok/arraydeque/branch/master/graph/badge.svg)](https://codecov.io/gh/goandylok/arraydeque)
|
||||
[![crates.io](https://img.shields.io/crates/v/arraydeque.svg)](https://crates.io/crates/arraydeque)
|
||||
[![docs.rs](https://docs.rs/arraydeque/badge.svg)](https://docs.rs/arraydeque)
|
||||
|
||||
A circular buffer with fixed capacity. Requires Rust 1.15+.
|
||||
|
||||
This crate is inspired by [**bluss/arrayvec**](https://github.com/bluss/arrayvec)
|
||||
|
||||
### [**Documentation**](https://docs.rs/arraydeque)
|
||||
|
||||
## Feature Flags
|
||||
|
||||
The **arraydeque** crate has the following cargo feature flags:
|
||||
|
||||
- `std`
|
||||
- Optional, enabled by default
|
||||
- Use libstd
|
||||
|
||||
|
||||
- `use_union`
|
||||
- Optional
|
||||
- Requires Rust nightly channel
|
||||
- Use the unstable feature untagged unions for the internal implementation,
|
||||
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 ArrayDeque storage.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
First, add the following to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
arraydeque = "0.2"
|
||||
```
|
||||
|
||||
Next, add this to your crate root:
|
||||
|
||||
```rust
|
||||
extern crate arraydeque;
|
||||
```
|
||||
|
||||
Currently arraydeque by default links to the standard library, but if you would
|
||||
instead like to use arraydeque in a `#![no_std]` situation or crate you can
|
||||
request this via:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
arraydeque = { version = "0.2", default-features = false }
|
||||
```
|
||||
## Capacity
|
||||
|
||||
Note that the `capacity()` is always `backed_array.len() - 1`.
|
||||
[Read more]
|
||||
|
||||
[Read more]: https://en.wikipedia.org/wiki/Circular_buffer
|
||||
|
||||
## Example
|
||||
|
||||
### Push & Pop
|
||||
|
||||
```rust
|
||||
extern crate arraydeque;
|
||||
|
||||
use arraydeque::ArrayDeque;
|
||||
|
||||
fn main() {
|
||||
let mut vector: ArrayDeque<[_; 8]> = ArrayDeque::new();
|
||||
assert_eq!(vector.capacity(), 7);
|
||||
assert_eq!(vector.len(), 0);
|
||||
|
||||
vector.push_back(1);
|
||||
vector.push_back(2);
|
||||
assert_eq!(vector.len(), 2);
|
||||
|
||||
assert_eq!(vector.pop_front(), Some(1));
|
||||
assert_eq!(vector.pop_front(), Some(2));
|
||||
assert_eq!(vector.pop_front(), None);
|
||||
}
|
||||
```
|
||||
|
||||
### Insert & Remove
|
||||
|
||||
```rust
|
||||
use arraydeque::ArrayDeque;
|
||||
|
||||
let mut vector: ArrayDeque<[_; 8]> = ArrayDeque::new();
|
||||
|
||||
vector.push_back(11);
|
||||
vector.push_back(13);
|
||||
vector.insert(1, 12);
|
||||
vector.remove(0);
|
||||
|
||||
assert_eq!(vector[0], 12);
|
||||
assert_eq!(vector[1], 13);
|
||||
```
|
||||
|
||||
### Append & Extend
|
||||
|
||||
```rust
|
||||
use arraydeque::ArrayDeque;
|
||||
|
||||
let mut vector: ArrayDeque<[_; 8]> = ArrayDeque::new();
|
||||
let mut vector2: ArrayDeque<[_; 8]> = ArrayDeque::new();
|
||||
|
||||
vector.extend(0..5);
|
||||
vector2.extend(5..7);
|
||||
|
||||
assert_eq!(format!("{:?}", vector), "[0, 1, 2, 3, 4]");
|
||||
assert_eq!(format!("{:?}", vector2), "[5, 6]");
|
||||
|
||||
vector.append(&mut vector2);
|
||||
|
||||
assert_eq!(format!("{:?}", vector), "[0, 1, 2, 3, 4, 5, 6]");
|
||||
assert_eq!(format!("{:?}", vector2), "[]");
|
||||
```
|
||||
|
||||
### Iterator
|
||||
|
||||
```rust
|
||||
use arraydeque::ArrayDeque;
|
||||
|
||||
let mut vector: ArrayDeque<[_; 8]> = ArrayDeque::new();
|
||||
|
||||
vector.extend(0..5);
|
||||
|
||||
let iters: Vec<_> = vector.into_iter().collect();
|
||||
assert_eq!(iters, vec![0, 1, 2, 3, 4]);
|
||||
```
|
||||
|
||||
### From Iterator
|
||||
|
||||
```rust
|
||||
use arraydeque::ArrayDeque;
|
||||
|
||||
let vector: ArrayDeque<[_; 8]>;
|
||||
let vector2: ArrayDeque<[_; 8]>;
|
||||
|
||||
vector = vec![0, 1, 2, 3, 4].into_iter().collect();
|
||||
|
||||
vector2 = (0..5).into_iter().collect();
|
||||
|
||||
assert_eq!(vector, vector2);
|
||||
```
|
||||
|
||||
### Generic Array
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
generic-array = "0.5.1"
|
||||
|
||||
[dependencies.arraydeque]
|
||||
version = "0.2"
|
||||
features = ["use_generic_array"]
|
||||
```
|
||||
```rust
|
||||
#[macro_use]
|
||||
extern crate generic_array;
|
||||
extern crate arraydeque;
|
||||
|
||||
use generic_array::GenericArray;
|
||||
use generic_array::typenum::U41;
|
||||
|
||||
use arraydeque::ArrayDeque;
|
||||
|
||||
fn main() {
|
||||
let mut vec: ArrayDeque<GenericArray<i32, U41>> = ArrayDeque::new();
|
||||
|
||||
assert_eq!(vec.len(), 0);
|
||||
assert_eq!(vec.capacity(), 40);
|
||||
|
||||
vec.extend(0..20);
|
||||
|
||||
assert_eq!(vec.len(), 20);
|
||||
assert_eq!(vec.into_iter().take(5).collect::<Vec<_>>(), vec![0, 1, 2, 3, 4]);
|
||||
}
|
||||
```
|
||||
|
||||
## Contribution
|
||||
|
||||
All kinds of contribution are welcomed.
|
||||
|
||||
- **Issus.** Feel free to open an issue when you find typos, bugs, or have any question.
|
||||
- **Pull requests**. New collection, better implementation, more tests, more documents and typo fixes are all welcomed.
|
||||
|
||||
## License
|
||||
|
||||
Licensed under MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
|
@ -1,86 +0,0 @@
|
|||
/// Trait for fixed size arrays.
|
||||
pub unsafe trait Array {
|
||||
/// The array's element type
|
||||
type Item;
|
||||
#[doc(hidden)]
|
||||
/// The smallest index type that indexes the array.
|
||||
type Index: Index;
|
||||
#[doc(hidden)]
|
||||
fn as_ptr(&self) -> *const Self::Item;
|
||||
#[doc(hidden)]
|
||||
fn as_mut_ptr(&mut self) -> *mut Self::Item;
|
||||
#[doc(hidden)]
|
||||
fn capacity() -> usize;
|
||||
}
|
||||
|
||||
pub trait Index : PartialEq + Copy {
|
||||
fn to_usize(self) -> usize;
|
||||
fn from(usize) -> Self;
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[inline(always)]
|
||||
fn to_usize(self) -> usize { self as usize }
|
||||
#[inline(always)]
|
||||
fn from(ix: usize) -> Self { ix as u8 }
|
||||
}
|
||||
|
||||
impl Index for u16 {
|
||||
#[inline(always)]
|
||||
fn to_usize(self) -> usize { self as usize }
|
||||
#[inline(always)]
|
||||
fn from(ix: usize) -> Self { ix as u16 }
|
||||
}
|
||||
|
||||
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 {
|
||||
($index_type:ty, $len:expr ) => (
|
||||
unsafe impl<T> Array for [T; $len] {
|
||||
type Item = T;
|
||||
type Index = $index_type;
|
||||
#[inline(always)]
|
||||
fn as_ptr(&self) -> *const T { self as *const _ as *const _ }
|
||||
#[inline(always)]
|
||||
fn as_mut_ptr(&mut self) -> *mut T { self as *mut _ as *mut _}
|
||||
#[inline(always)]
|
||||
fn capacity() -> usize { $len }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
macro_rules! fix_array_impl_recursive {
|
||||
($index_type:ty, ) => ();
|
||||
($index_type:ty, $len:expr, $($more:expr,)*) => (
|
||||
fix_array_impl!($index_type, $len);
|
||||
fix_array_impl_recursive!($index_type, $($more,)*);
|
||||
);
|
||||
}
|
||||
|
||||
fix_array_impl_recursive!(u8, 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,
|
||||
32, 40, 48, 56, 64, 72, 96, 128, 160, 192, 224,);
|
||||
fix_array_impl_recursive!(u16, 256, 384, 512, 768, 1024, 2048, 4096, 8192, 16384, 32768,);
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -31,15 +31,6 @@ dependencies = [
|
|||
"serde 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arraydeque"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.3.23"
|
||||
|
@ -1247,7 +1238,6 @@ name = "style"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"arraydeque 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bindgen 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1601,7 +1591,6 @@ dependencies = [
|
|||
"checksum aho-corasick 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0638fd549427caa90c499814196d1b9e3725eb4d15d7339d6de073a680ed0ca2"
|
||||
"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"
|
||||
"checksum app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ed0a4de09a3b8449515e649f3bb84f72ea15fc2d10639beb0776a09b7d308074"
|
||||
"checksum arraydeque 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "96e774cadb24c2245225280c6799793f9802b918a58a79615e9490607489a717"
|
||||
"checksum arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "699e63a93b79d717e8c3b5eb1b28b7780d0d6d9e59a72eb769291c83b0c8dc67"
|
||||
"checksum aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfdf7355d9db158df68f976ed030ab0f6578af811f5a7bb6dcf221ec24e0e0"
|
||||
"checksum atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb2dcb6e6d35f20276943cc04bb98e538b348d525a04ac79c10021561d202f21"
|
||||
|
|
|
@ -29,15 +29,6 @@ dependencies = [
|
|||
"serde 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arraydeque"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.3.23"
|
||||
|
@ -1234,7 +1225,6 @@ name = "style"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"arraydeque 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bindgen 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1588,7 +1578,6 @@ dependencies = [
|
|||
"checksum aho-corasick 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0638fd549427caa90c499814196d1b9e3725eb4d15d7339d6de073a680ed0ca2"
|
||||
"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"
|
||||
"checksum app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ed0a4de09a3b8449515e649f3bb84f72ea15fc2d10639beb0776a09b7d308074"
|
||||
"checksum arraydeque 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "96e774cadb24c2245225280c6799793f9802b918a58a79615e9490607489a717"
|
||||
"checksum arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "699e63a93b79d717e8c3b5eb1b28b7780d0d6d9e59a72eb769291c83b0c8dc67"
|
||||
"checksum aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfdf7355d9db158df68f976ed030ab0f6578af811f5a7bb6dcf221ec24e0e0"
|
||||
"checksum atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb2dcb6e6d35f20276943cc04bb98e538b348d525a04ac79c10021561d202f21"
|
||||
|
|
Загрузка…
Ссылка в новой задаче