Revert "set gitattributes for rust & cargo so hashes dont conflict on Windows"

This reverts commit 032dc5c108195f6bbc2e224f00da5b785df4b7f9.
This commit is contained in:
Grant Limberg 2023-03-01 14:27:19 -08:00
parent 032dc5c108
commit 047e327f01
No known key found for this signature in database
GPG Key ID: 8F2F97D3BE8D7735
595 changed files with 74694 additions and 74701 deletions

View File

@ -1,7 +0,0 @@
* text=auto
* text eol=lf
*.vcxproj eol=crlf
*.vcxproj.filters eol=crlf
*.a binary
*.lib binary

View File

@ -1,11 +1,11 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct Dummy {
int32_t x;
float y;
} Dummy;
void root(struct Dummy d);
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct Dummy {
int32_t x;
float y;
} Dummy;
void root(struct Dummy d);

View File

@ -1,19 +1,19 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct Dummy {
int32_t x;
float y;
} Dummy;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void root(struct Dummy d);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct Dummy {
int32_t x;
float y;
} Dummy;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void root(struct Dummy d);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -1,11 +1,11 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct {
int32_t x;
float y;
} Dummy;
void root(Dummy d);
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct {
int32_t x;
float y;
} Dummy;
void root(Dummy d);

View File

@ -1,19 +1,19 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct {
int32_t x;
float y;
} Dummy;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void root(Dummy d);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct {
int32_t x;
float y;
} Dummy;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void root(Dummy d);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -1,16 +1,16 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>
struct Dummy {
int32_t x;
float y;
};
extern "C" {
void root(Dummy d);
} // extern "C"
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>
struct Dummy {
int32_t x;
float y;
};
extern "C" {
void root(Dummy d);
} // extern "C"

View File

@ -1,13 +1,13 @@
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
cdef extern from *:
ctypedef bint bool
ctypedef struct va_list
cdef extern from *:
ctypedef struct Dummy:
int32_t x;
float y;
void root(Dummy d);
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
cdef extern from *:
ctypedef bint bool
ctypedef struct va_list
cdef extern from *:
ctypedef struct Dummy:
int32_t x;
float y;
void root(Dummy d);

View File

@ -1,11 +1,11 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
struct Dummy {
int32_t x;
float y;
};
void root(struct Dummy d);
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
struct Dummy {
int32_t x;
float y;
};
void root(struct Dummy d);

View File

@ -1,19 +1,19 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
struct Dummy {
int32_t x;
float y;
};
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void root(struct Dummy d);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
struct Dummy {
int32_t x;
float y;
};
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void root(struct Dummy d);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -1,13 +1,13 @@
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
cdef extern from *:
ctypedef bint bool
ctypedef struct va_list
cdef extern from *:
cdef struct Dummy:
int32_t x;
float y;
void root(Dummy d);
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
cdef extern from *:
ctypedef bint bool
ctypedef struct va_list
cdef extern from *:
cdef struct Dummy:
int32_t x;
float y;
void root(Dummy d);

View File

@ -1,93 +1,93 @@
* **`0.14.5`**
* Fix unsoundness behavior in `GenericArrayIter::clone` ([#120](https://github.com/fizyk20/generic-array/pull/120))
* **`0.14.4`**
* Update `typenum` to `1.12.0`
* Make `Drop` a no-op when the inner type does not require `Drop` (using `core::mem::needs_drop`)
* **`0.14.3`**
* Improve behavior of `GenericArray::from_exact_iter` to assume `ExactIterator`s can lie.
* Fix alignment of zero-length `GenericArray`s
* Implement `From<&[T; N]> for &GenericArray<T, N>` and its mutable variant
* **`0.14.2`**
* Lower MSRV to `1.36.0` without `From<[T; N]>` implementations.
* **`0.14.1`**
* Fix element conversions in `arr!` macro.
* **`0.14.0`**
* Replace `Into` implementations with the more general `From`.
* Requires minumum Rust version of 1.41.0
* Fix unsoundness in `arr!` macro.
* Fix meta variable misuse
* Fix Undefined Behavior across the crate by switching to `MaybeUninit`
* Improve some documentation and doctests
* Add `AsRef<[T; N]>` and `AsMut<[T; N]>` impls to `GenericArray<T, N>`
* Add `Split` impl for `&GenericArray` and `&mut GenericArray`
* **`0.13.2`**
* Add feature `more_lengths`, which adds more `From`/`Into` implementations for arrays of various lengths.
* **`0.13.1`**
* Mark `GenericArray` as `#[repr(transparent)]`
* Implement `Into<[T; N]>` for `GenericArray<T, N>` up to N=32
* **`0.13.0`**
* Allow `arr!` to be imported with use syntax.
* Requires minumum Rust version of 1.30.1
* **`0.12.2`**
* Implement `FusedIterator` for `GenericArrayIter`
* **`0.12.1`**
* Use internal iteration where possible and provide more efficient internal iteration methods.
* **`0.12.0`**
* Allow trailing commas in `arr!` macro.
* **BREAKING**: Serialize `GenericArray` using `serde` tuples, instead of variable-length sequences. This may not be compatible with old serialized data.
* **`0.11.0`**
* **BREAKING** Redesign `GenericSequence` with an emphasis on use in generic type parameters.
* Add `MappedGenericSequence` and `FunctionalSequence`
* Implements optimized `map`, `zip` and `fold` for `GenericArray`, `&GenericArray` and `&mut GenericArray`
* **BREAKING** Remove `map_ref`, `zip_ref` and `map_slice`
* `map_slice` is now equivalent to `GenericArray::from_iter(slice.iter().map(...))`
* **`0.10.0`**
* Add `GenericSequence`, `Lengthen`, `Shorten`, `Split` and `Concat` traits.
* Redefine `transmute` to avert errors.
* **`0.9.0`**
* Rewrite construction methods to be well-defined in panic situations, correctly dropping elements.
* `NoDrop` crate replaced by `ManuallyDrop` as it became stable in Rust core.
* Add optimized `map`/`map_ref` and `zip`/`zip_ref` methods to `GenericArray`
* **`0.8.0`**
* Implement `AsRef`, `AsMut`, `Borrow`, `BorrowMut`, `Hash` for `GenericArray`
* Update `serde` to `1.0`
* Update `typenum`
* Make macro `arr!` non-cloning
* Implement `From<[T; N]>` up to `N=32`
* Fix #45
* **`0.7.0`**
* Upgrade `serde` to `0.9`
* Make `serde` with `no_std`
* Implement `PartialOrd`/`Ord` for `GenericArray`
* **`0.6.0`**
* Fixed #30
* Implement `Default` for `GenericArray`
* Implement `LowerHex` and `UpperHex` for `GenericArray<u8, N>`
* Use `precision` formatting field in hex representation
* Add `as_slice`, `as_mut_slice`
* Remove `GenericArray::new` in favor of `Default` trait
* Add `from_slice` and `from_mut_slice`
* `no_std` and `core` for crate.
* **`0.5.0`**
* Update `serde`
* remove `no_std` feature, fixed #19
* **`0.4.0`**
* Re-export `typenum`
* **`0.3.0`**
* Implement `IntoIter` for `GenericArray`
* Add `map` method
* Add optional `serde` (de)serialization support feature.
* **`< 0.3.0`**
* Initial implementation in late 2015
* **`0.14.5`**
* Fix unsoundness behavior in `GenericArrayIter::clone` ([#120](https://github.com/fizyk20/generic-array/pull/120))
* **`0.14.4`**
* Update `typenum` to `1.12.0`
* Make `Drop` a no-op when the inner type does not require `Drop` (using `core::mem::needs_drop`)
* **`0.14.3`**
* Improve behavior of `GenericArray::from_exact_iter` to assume `ExactIterator`s can lie.
* Fix alignment of zero-length `GenericArray`s
* Implement `From<&[T; N]> for &GenericArray<T, N>` and its mutable variant
* **`0.14.2`**
* Lower MSRV to `1.36.0` without `From<[T; N]>` implementations.
* **`0.14.1`**
* Fix element conversions in `arr!` macro.
* **`0.14.0`**
* Replace `Into` implementations with the more general `From`.
* Requires minumum Rust version of 1.41.0
* Fix unsoundness in `arr!` macro.
* Fix meta variable misuse
* Fix Undefined Behavior across the crate by switching to `MaybeUninit`
* Improve some documentation and doctests
* Add `AsRef<[T; N]>` and `AsMut<[T; N]>` impls to `GenericArray<T, N>`
* Add `Split` impl for `&GenericArray` and `&mut GenericArray`
* **`0.13.2`**
* Add feature `more_lengths`, which adds more `From`/`Into` implementations for arrays of various lengths.
* **`0.13.1`**
* Mark `GenericArray` as `#[repr(transparent)]`
* Implement `Into<[T; N]>` for `GenericArray<T, N>` up to N=32
* **`0.13.0`**
* Allow `arr!` to be imported with use syntax.
* Requires minumum Rust version of 1.30.1
* **`0.12.2`**
* Implement `FusedIterator` for `GenericArrayIter`
* **`0.12.1`**
* Use internal iteration where possible and provide more efficient internal iteration methods.
* **`0.12.0`**
* Allow trailing commas in `arr!` macro.
* **BREAKING**: Serialize `GenericArray` using `serde` tuples, instead of variable-length sequences. This may not be compatible with old serialized data.
* **`0.11.0`**
* **BREAKING** Redesign `GenericSequence` with an emphasis on use in generic type parameters.
* Add `MappedGenericSequence` and `FunctionalSequence`
* Implements optimized `map`, `zip` and `fold` for `GenericArray`, `&GenericArray` and `&mut GenericArray`
* **BREAKING** Remove `map_ref`, `zip_ref` and `map_slice`
* `map_slice` is now equivalent to `GenericArray::from_iter(slice.iter().map(...))`
* **`0.10.0`**
* Add `GenericSequence`, `Lengthen`, `Shorten`, `Split` and `Concat` traits.
* Redefine `transmute` to avert errors.
* **`0.9.0`**
* Rewrite construction methods to be well-defined in panic situations, correctly dropping elements.
* `NoDrop` crate replaced by `ManuallyDrop` as it became stable in Rust core.
* Add optimized `map`/`map_ref` and `zip`/`zip_ref` methods to `GenericArray`
* **`0.8.0`**
* Implement `AsRef`, `AsMut`, `Borrow`, `BorrowMut`, `Hash` for `GenericArray`
* Update `serde` to `1.0`
* Update `typenum`
* Make macro `arr!` non-cloning
* Implement `From<[T; N]>` up to `N=32`
* Fix #45
* **`0.7.0`**
* Upgrade `serde` to `0.9`
* Make `serde` with `no_std`
* Implement `PartialOrd`/`Ord` for `GenericArray`
* **`0.6.0`**
* Fixed #30
* Implement `Default` for `GenericArray`
* Implement `LowerHex` and `UpperHex` for `GenericArray<u8, N>`
* Use `precision` formatting field in hex representation
* Add `as_slice`, `as_mut_slice`
* Remove `GenericArray::new` in favor of `Default` trait
* Add `from_slice` and `from_mut_slice`
* `no_std` and `core` for crate.
* **`0.5.0`**
* Update `serde`
* remove `no_std` feature, fixed #19
* **`0.4.0`**
* Re-export `typenum`
* **`0.3.0`**
* Implement `IntoIter` for `GenericArray`
* Add `map` method
* Add optional `serde` (de)serialization support feature.
* **`< 0.3.0`**
* Initial implementation in late 2015

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Bartłomiej Kamiński
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
The MIT License (MIT)
Copyright (c) 2015 Bartłomiej Kamiński
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.

View File

@ -1,62 +1,62 @@
[![Crates.io](https://img.shields.io/crates/v/generic-array.svg)](https://crates.io/crates/generic-array)
[![Build Status](https://travis-ci.org/fizyk20/generic-array.svg?branch=master)](https://travis-ci.org/fizyk20/generic-array)
# generic-array
This crate implements generic array types for Rust.
**Requires minumum Rust version of 1.36.0, or 1.41.0 for `From<[T; N]>` implementations**
[Documentation](http://fizyk20.github.io/generic-array/generic_array/)
## Usage
The Rust arrays `[T; N]` are problematic in that they can't be used generically with respect to `N`, so for example this won't work:
```rust
struct Foo<N> {
data: [i32; N]
}
```
**generic-array** defines a new trait `ArrayLength<T>` and a struct `GenericArray<T, N: ArrayLength<T>>`, which let the above be implemented as:
```rust
struct Foo<N: ArrayLength<i32>> {
data: GenericArray<i32, N>
}
```
The `ArrayLength<T>` trait is implemented by default for [unsigned integer types](http://fizyk20.github.io/generic-array/typenum/uint/index.html) from [typenum](http://fizyk20.github.io/generic-array/typenum/index.html) crate:
```rust
use generic_array::typenum::U5;
struct Foo<N: ArrayLength<i32>> {
data: GenericArray<i32, N>
}
fn main() {
let foo = Foo::<U5>{data: GenericArray::default()};
}
```
For example, `GenericArray<T, U5>` would work almost like `[T; 5]`:
```rust
use generic_array::typenum::U5;
struct Foo<T, N: ArrayLength<T>> {
data: GenericArray<T, N>
}
fn main() {
let foo = Foo::<i32, U5>{data: GenericArray::default()};
}
```
In version 0.1.1 an `arr!` macro was introduced, allowing for creation of arrays as shown below:
```rust
let array = arr![u32; 1, 2, 3];
assert_eq!(array[2], 3);
```
[![Crates.io](https://img.shields.io/crates/v/generic-array.svg)](https://crates.io/crates/generic-array)
[![Build Status](https://travis-ci.org/fizyk20/generic-array.svg?branch=master)](https://travis-ci.org/fizyk20/generic-array)
# generic-array
This crate implements generic array types for Rust.
**Requires minumum Rust version of 1.36.0, or 1.41.0 for `From<[T; N]>` implementations**
[Documentation](http://fizyk20.github.io/generic-array/generic_array/)
## Usage
The Rust arrays `[T; N]` are problematic in that they can't be used generically with respect to `N`, so for example this won't work:
```rust
struct Foo<N> {
data: [i32; N]
}
```
**generic-array** defines a new trait `ArrayLength<T>` and a struct `GenericArray<T, N: ArrayLength<T>>`, which let the above be implemented as:
```rust
struct Foo<N: ArrayLength<i32>> {
data: GenericArray<i32, N>
}
```
The `ArrayLength<T>` trait is implemented by default for [unsigned integer types](http://fizyk20.github.io/generic-array/typenum/uint/index.html) from [typenum](http://fizyk20.github.io/generic-array/typenum/index.html) crate:
```rust
use generic_array::typenum::U5;
struct Foo<N: ArrayLength<i32>> {
data: GenericArray<i32, N>
}
fn main() {
let foo = Foo::<U5>{data: GenericArray::default()};
}
```
For example, `GenericArray<T, U5>` would work almost like `[T; 5]`:
```rust
use generic_array::typenum::U5;
struct Foo<T, N: ArrayLength<T>> {
data: GenericArray<T, N>
}
fn main() {
let foo = Foo::<i32, U5>{data: GenericArray::default()};
}
```
In version 0.1.1 an `arr!` macro was introduced, allowing for creation of arrays as shown below:
```rust
let array = arr![u32; 1, 2, 3];
assert_eq!(array[2], 3);
```

View File

@ -1,5 +1,5 @@
fn main() {
if version_check::is_min_version("1.41.0").unwrap_or(false) {
println!("cargo:rustc-cfg=relaxed_coherence");
}
}
fn main() {
if version_check::is_min_version("1.41.0").unwrap_or(false) {
println!("cargo:rustc-cfg=relaxed_coherence");
}
}

View File

@ -1,3 +1,3 @@
reorder_imports = true
reorder_imported_names = true
use_try_shorthand = true
reorder_imports = true
reorder_imported_names = true
use_try_shorthand = true

View File

@ -1,125 +1,125 @@
//! Implementation for `arr!` macro.
use super::ArrayLength;
use core::ops::Add;
use typenum::U1;
/// Helper trait for `arr!` macro
pub trait AddLength<T, N: ArrayLength<T>>: ArrayLength<T> {
/// Resulting length
type Output: ArrayLength<T>;
}
impl<T, N1, N2> AddLength<T, N2> for N1
where
N1: ArrayLength<T> + Add<N2>,
N2: ArrayLength<T>,
<N1 as Add<N2>>::Output: ArrayLength<T>,
{
type Output = <N1 as Add<N2>>::Output;
}
/// Helper type for `arr!` macro
pub type Inc<T, U> = <U as AddLength<T, U1>>::Output;
#[doc(hidden)]
#[macro_export]
macro_rules! arr_impl {
(@replace_expr $e:expr) => { 1 };
($T:ty; $N:ty, [$($x:expr),*], []) => ({
const __ARR_LENGTH: usize = 0 $(+ $crate::arr_impl!(@replace_expr $x) )*;
#[inline(always)]
fn __do_transmute<T, N: $crate::ArrayLength<T>>(arr: [T; __ARR_LENGTH]) -> $crate::GenericArray<T, N> {
unsafe { $crate::transmute(arr) }
}
let _: [(); <$N as $crate::typenum::Unsigned>::USIZE] = [(); __ARR_LENGTH];
__do_transmute::<$T, $N>([$($x as $T),*])
});
($T:ty; $N:ty, [], [$x1:expr]) => (
$crate::arr_impl!($T; $crate::arr::Inc<$T, $N>, [$x1], [])
);
($T:ty; $N:ty, [], [$x1:expr, $($x:expr),+]) => (
$crate::arr_impl!($T; $crate::arr::Inc<$T, $N>, [$x1], [$($x),+])
);
($T:ty; $N:ty, [$($y:expr),+], [$x1:expr]) => (
$crate::arr_impl!($T; $crate::arr::Inc<$T, $N>, [$($y),+, $x1], [])
);
($T:ty; $N:ty, [$($y:expr),+], [$x1:expr, $($x:expr),+]) => (
$crate::arr_impl!($T; $crate::arr::Inc<$T, $N>, [$($y),+, $x1], [$($x),+])
);
}
/// Macro allowing for easy generation of Generic Arrays.
/// Example: `let test = arr![u32; 1, 2, 3];`
#[macro_export]
macro_rules! arr {
($T:ty; $(,)*) => ({
unsafe { $crate::transmute::<[$T; 0], $crate::GenericArray<$T, $crate::typenum::U0>>([]) }
});
($T:ty; $($x:expr),* $(,)*) => (
$crate::arr_impl!($T; $crate::typenum::U0, [], [$($x),*])
);
($($x:expr,)+) => (arr![$($x),+]);
() => ("""Macro requires a type, e.g. `let array = arr![u32; 1, 2, 3];`")
}
mod doctests_only {
///
/// # With ellision
///
/// Testing that lifetimes aren't transmuted when they're ellided.
///
/// ```compile_fail
/// #[macro_use] extern crate generic_array;
/// fn main() {
/// fn unsound_lifetime_extension<'a, A>(a: &'a A) -> &'static A {
/// arr![&A; a][0]
/// }
/// }
/// ```
///
/// ```rust
/// #[macro_use] extern crate generic_array;
/// fn main() {
/// fn unsound_lifetime_extension<'a, A>(a: &'a A) -> &'a A {
/// arr![&A; a][0]
/// }
/// }
/// ```
///
/// # Without ellision
///
/// Testing that lifetimes aren't transmuted when they're specified explicitly.
///
/// ```compile_fail
/// #[macro_use] extern crate generic_array;
/// fn main() {
/// fn unsound_lifetime_extension<'a, A>(a: &'a A) -> &'static A {
/// arr![&'a A; a][0]
/// }
/// }
/// ```
///
/// ```compile_fail
/// #[macro_use] extern crate generic_array;
/// fn main() {
/// fn unsound_lifetime_extension<'a, A>(a: &'a A) -> &'static A {
/// arr![&'static A; a][0]
/// }
/// }
/// ```
///
/// ```rust
/// #[macro_use] extern crate generic_array;
/// fn main() {
/// fn unsound_lifetime_extension<'a, A>(a: &'a A) -> &'a A {
/// arr![&'a A; a][0]
/// }
/// }
/// ```
#[allow(dead_code)]
pub enum DocTests {}
}
//! Implementation for `arr!` macro.
use super::ArrayLength;
use core::ops::Add;
use typenum::U1;
/// Helper trait for `arr!` macro
pub trait AddLength<T, N: ArrayLength<T>>: ArrayLength<T> {
/// Resulting length
type Output: ArrayLength<T>;
}
impl<T, N1, N2> AddLength<T, N2> for N1
where
N1: ArrayLength<T> + Add<N2>,
N2: ArrayLength<T>,
<N1 as Add<N2>>::Output: ArrayLength<T>,
{
type Output = <N1 as Add<N2>>::Output;
}
/// Helper type for `arr!` macro
pub type Inc<T, U> = <U as AddLength<T, U1>>::Output;
#[doc(hidden)]
#[macro_export]
macro_rules! arr_impl {
(@replace_expr $e:expr) => { 1 };
($T:ty; $N:ty, [$($x:expr),*], []) => ({
const __ARR_LENGTH: usize = 0 $(+ $crate::arr_impl!(@replace_expr $x) )*;
#[inline(always)]
fn __do_transmute<T, N: $crate::ArrayLength<T>>(arr: [T; __ARR_LENGTH]) -> $crate::GenericArray<T, N> {
unsafe { $crate::transmute(arr) }
}
let _: [(); <$N as $crate::typenum::Unsigned>::USIZE] = [(); __ARR_LENGTH];
__do_transmute::<$T, $N>([$($x as $T),*])
});
($T:ty; $N:ty, [], [$x1:expr]) => (
$crate::arr_impl!($T; $crate::arr::Inc<$T, $N>, [$x1], [])
);
($T:ty; $N:ty, [], [$x1:expr, $($x:expr),+]) => (
$crate::arr_impl!($T; $crate::arr::Inc<$T, $N>, [$x1], [$($x),+])
);
($T:ty; $N:ty, [$($y:expr),+], [$x1:expr]) => (
$crate::arr_impl!($T; $crate::arr::Inc<$T, $N>, [$($y),+, $x1], [])
);
($T:ty; $N:ty, [$($y:expr),+], [$x1:expr, $($x:expr),+]) => (
$crate::arr_impl!($T; $crate::arr::Inc<$T, $N>, [$($y),+, $x1], [$($x),+])
);
}
/// Macro allowing for easy generation of Generic Arrays.
/// Example: `let test = arr![u32; 1, 2, 3];`
#[macro_export]
macro_rules! arr {
($T:ty; $(,)*) => ({
unsafe { $crate::transmute::<[$T; 0], $crate::GenericArray<$T, $crate::typenum::U0>>([]) }
});
($T:ty; $($x:expr),* $(,)*) => (
$crate::arr_impl!($T; $crate::typenum::U0, [], [$($x),*])
);
($($x:expr,)+) => (arr![$($x),+]);
() => ("""Macro requires a type, e.g. `let array = arr![u32; 1, 2, 3];`")
}
mod doctests_only {
///
/// # With ellision
///
/// Testing that lifetimes aren't transmuted when they're ellided.
///
/// ```compile_fail
/// #[macro_use] extern crate generic_array;
/// fn main() {
/// fn unsound_lifetime_extension<'a, A>(a: &'a A) -> &'static A {
/// arr![&A; a][0]
/// }
/// }
/// ```
///
/// ```rust
/// #[macro_use] extern crate generic_array;
/// fn main() {
/// fn unsound_lifetime_extension<'a, A>(a: &'a A) -> &'a A {
/// arr![&A; a][0]
/// }
/// }
/// ```
///
/// # Without ellision
///
/// Testing that lifetimes aren't transmuted when they're specified explicitly.
///
/// ```compile_fail
/// #[macro_use] extern crate generic_array;
/// fn main() {
/// fn unsound_lifetime_extension<'a, A>(a: &'a A) -> &'static A {
/// arr![&'a A; a][0]
/// }
/// }
/// ```
///
/// ```compile_fail
/// #[macro_use] extern crate generic_array;
/// fn main() {
/// fn unsound_lifetime_extension<'a, A>(a: &'a A) -> &'static A {
/// arr![&'static A; a][0]
/// }
/// }
/// ```
///
/// ```rust
/// #[macro_use] extern crate generic_array;
/// fn main() {
/// fn unsound_lifetime_extension<'a, A>(a: &'a A) -> &'a A {
/// arr![&'a A; a][0]
/// }
/// }
/// ```
#[allow(dead_code)]
pub enum DocTests {}
}

View File

@ -1,95 +1,95 @@
//! Functional programming with generic sequences
//!
//! Please see `tests/generics.rs` for examples of how to best use these in your generic functions.
use super::ArrayLength;
use core::iter::FromIterator;
use crate::sequence::*;
/// Defines the relationship between one generic sequence and another,
/// for operations such as `map` and `zip`.
pub unsafe trait MappedGenericSequence<T, U>: GenericSequence<T>
where
Self::Length: ArrayLength<U>,
{
/// Mapped sequence type
type Mapped: GenericSequence<U, Length = Self::Length>;
}
unsafe impl<'a, T, U, S: MappedGenericSequence<T, U>> MappedGenericSequence<T, U> for &'a S
where
&'a S: GenericSequence<T>,
S: GenericSequence<T, Length = <&'a S as GenericSequence<T>>::Length>,
<S as GenericSequence<T>>::Length: ArrayLength<U>,
{
type Mapped = <S as MappedGenericSequence<T, U>>::Mapped;
}
unsafe impl<'a, T, U, S: MappedGenericSequence<T, U>> MappedGenericSequence<T, U> for &'a mut S
where
&'a mut S: GenericSequence<T>,
S: GenericSequence<T, Length = <&'a mut S as GenericSequence<T>>::Length>,
<S as GenericSequence<T>>::Length: ArrayLength<U>,
{
type Mapped = <S as MappedGenericSequence<T, U>>::Mapped;
}
/// Accessor type for a mapped generic sequence
pub type MappedSequence<S, T, U> =
<<S as MappedGenericSequence<T, U>>::Mapped as GenericSequence<U>>::Sequence;
/// Defines functional programming methods for generic sequences
pub unsafe trait FunctionalSequence<T>: GenericSequence<T> {
/// Maps a `GenericSequence` to another `GenericSequence`.
///
/// If the mapping function panics, any already initialized elements in the new sequence
/// will be dropped, AND any unused elements in the source sequence will also be dropped.
fn map<U, F>(self, f: F) -> MappedSequence<Self, T, U>
where
Self: MappedGenericSequence<T, U>,
Self::Length: ArrayLength<U>,
F: FnMut(Self::Item) -> U,
{
FromIterator::from_iter(self.into_iter().map(f))
}
/// Combines two `GenericSequence` instances and iterates through both of them,
/// initializing a new `GenericSequence` with the result of the zipped mapping function.
///
/// If the mapping function panics, any already initialized elements in the new sequence
/// will be dropped, AND any unused elements in the source sequences will also be dropped.
#[inline]
fn zip<B, Rhs, U, F>(self, rhs: Rhs, f: F) -> MappedSequence<Self, T, U>
where
Self: MappedGenericSequence<T, U>,
Rhs: MappedGenericSequence<B, U, Mapped = MappedSequence<Self, T, U>>,
Self::Length: ArrayLength<B> + ArrayLength<U>,
Rhs: GenericSequence<B, Length = Self::Length>,
F: FnMut(Self::Item, Rhs::Item) -> U,
{
rhs.inverted_zip2(self, f)
}
/// Folds (or reduces) a sequence of data into a single value.
///
/// If the fold function panics, any unused elements will be dropped.
fn fold<U, F>(self, init: U, f: F) -> U
where
F: FnMut(U, Self::Item) -> U,
{
self.into_iter().fold(init, f)
}
}
unsafe impl<'a, T, S: GenericSequence<T>> FunctionalSequence<T> for &'a S
where
&'a S: GenericSequence<T>,
{
}
unsafe impl<'a, T, S: GenericSequence<T>> FunctionalSequence<T> for &'a mut S
where
&'a mut S: GenericSequence<T>,
{
}
//! Functional programming with generic sequences
//!
//! Please see `tests/generics.rs` for examples of how to best use these in your generic functions.
use super::ArrayLength;
use core::iter::FromIterator;
use crate::sequence::*;
/// Defines the relationship between one generic sequence and another,
/// for operations such as `map` and `zip`.
pub unsafe trait MappedGenericSequence<T, U>: GenericSequence<T>
where
Self::Length: ArrayLength<U>,
{
/// Mapped sequence type
type Mapped: GenericSequence<U, Length = Self::Length>;
}
unsafe impl<'a, T, U, S: MappedGenericSequence<T, U>> MappedGenericSequence<T, U> for &'a S
where
&'a S: GenericSequence<T>,
S: GenericSequence<T, Length = <&'a S as GenericSequence<T>>::Length>,
<S as GenericSequence<T>>::Length: ArrayLength<U>,
{
type Mapped = <S as MappedGenericSequence<T, U>>::Mapped;
}
unsafe impl<'a, T, U, S: MappedGenericSequence<T, U>> MappedGenericSequence<T, U> for &'a mut S
where
&'a mut S: GenericSequence<T>,
S: GenericSequence<T, Length = <&'a mut S as GenericSequence<T>>::Length>,
<S as GenericSequence<T>>::Length: ArrayLength<U>,
{
type Mapped = <S as MappedGenericSequence<T, U>>::Mapped;
}
/// Accessor type for a mapped generic sequence
pub type MappedSequence<S, T, U> =
<<S as MappedGenericSequence<T, U>>::Mapped as GenericSequence<U>>::Sequence;
/// Defines functional programming methods for generic sequences
pub unsafe trait FunctionalSequence<T>: GenericSequence<T> {
/// Maps a `GenericSequence` to another `GenericSequence`.
///
/// If the mapping function panics, any already initialized elements in the new sequence
/// will be dropped, AND any unused elements in the source sequence will also be dropped.
fn map<U, F>(self, f: F) -> MappedSequence<Self, T, U>
where
Self: MappedGenericSequence<T, U>,
Self::Length: ArrayLength<U>,
F: FnMut(Self::Item) -> U,
{
FromIterator::from_iter(self.into_iter().map(f))
}
/// Combines two `GenericSequence` instances and iterates through both of them,
/// initializing a new `GenericSequence` with the result of the zipped mapping function.
///
/// If the mapping function panics, any already initialized elements in the new sequence
/// will be dropped, AND any unused elements in the source sequences will also be dropped.
#[inline]
fn zip<B, Rhs, U, F>(self, rhs: Rhs, f: F) -> MappedSequence<Self, T, U>
where
Self: MappedGenericSequence<T, U>,
Rhs: MappedGenericSequence<B, U, Mapped = MappedSequence<Self, T, U>>,
Self::Length: ArrayLength<B> + ArrayLength<U>,
Rhs: GenericSequence<B, Length = Self::Length>,
F: FnMut(Self::Item, Rhs::Item) -> U,
{
rhs.inverted_zip2(self, f)
}
/// Folds (or reduces) a sequence of data into a single value.
///
/// If the fold function panics, any unused elements will be dropped.
fn fold<U, F>(self, init: U, f: F) -> U
where
F: FnMut(U, Self::Item) -> U,
{
self.into_iter().fold(init, f)
}
}
unsafe impl<'a, T, S: GenericSequence<T>> FunctionalSequence<T> for &'a S
where
&'a S: GenericSequence<T>,
{
}
unsafe impl<'a, T, S: GenericSequence<T>> FunctionalSequence<T> for &'a mut S
where
&'a mut S: GenericSequence<T>,
{
}

View File

@ -1,105 +1,105 @@
//! Generic array are commonly used as a return value for hash digests, so
//! it's a good idea to allow to hexlify them easily. This module implements
//! `std::fmt::LowerHex` and `std::fmt::UpperHex` traits.
//!
//! Example:
//!
//! ```rust
//! # #[macro_use]
//! # extern crate generic_array;
//! # extern crate typenum;
//! # fn main() {
//! let array = arr![u8; 10, 20, 30];
//! assert_eq!(format!("{:x}", array), "0a141e");
//! # }
//! ```
//!
use core::{fmt, str, ops::Add, cmp::min};
use typenum::*;
use crate::{ArrayLength, GenericArray};
static LOWER_CHARS: &'static [u8] = b"0123456789abcdef";
static UPPER_CHARS: &'static [u8] = b"0123456789ABCDEF";
impl<T: ArrayLength<u8>> fmt::LowerHex for GenericArray<u8, T>
where
T: Add<T>,
<T as Add<T>>::Output: ArrayLength<u8>,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let max_digits = f.precision().unwrap_or_else(|| self.len() * 2);
let max_hex = (max_digits >> 1) + (max_digits & 1);
if T::USIZE < 1024 {
// For small arrays use a stack allocated
// buffer of 2x number of bytes
let mut res = GenericArray::<u8, Sum<T, T>>::default();
self.iter().take(max_hex).enumerate().for_each(|(i, c)| {
res[i * 2] = LOWER_CHARS[(c >> 4) as usize];
res[i * 2 + 1] = LOWER_CHARS[(c & 0xF) as usize];
});
f.write_str(unsafe { str::from_utf8_unchecked(&res[..max_digits]) })?;
} else {
// For large array use chunks of up to 1024 bytes (2048 hex chars)
let mut buf = [0u8; 2048];
let mut digits_left = max_digits;
for chunk in self[..max_hex].chunks(1024) {
chunk.iter().enumerate().for_each(|(i, c)| {
buf[i * 2] = LOWER_CHARS[(c >> 4) as usize];
buf[i * 2 + 1] = LOWER_CHARS[(c & 0xF) as usize];
});
let n = min(chunk.len() * 2, digits_left);
f.write_str(unsafe { str::from_utf8_unchecked(&buf[..n]) })?;
digits_left -= n;
}
}
Ok(())
}
}
impl<T: ArrayLength<u8>> fmt::UpperHex for GenericArray<u8, T>
where
T: Add<T>,
<T as Add<T>>::Output: ArrayLength<u8>,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let max_digits = f.precision().unwrap_or_else(|| self.len() * 2);
let max_hex = (max_digits >> 1) + (max_digits & 1);
if T::USIZE < 1024 {
// For small arrays use a stack allocated
// buffer of 2x number of bytes
let mut res = GenericArray::<u8, Sum<T, T>>::default();
self.iter().take(max_hex).enumerate().for_each(|(i, c)| {
res[i * 2] = UPPER_CHARS[(c >> 4) as usize];
res[i * 2 + 1] = UPPER_CHARS[(c & 0xF) as usize];
});
f.write_str(unsafe { str::from_utf8_unchecked(&res[..max_digits]) })?;
} else {
// For large array use chunks of up to 1024 bytes (2048 hex chars)
let mut buf = [0u8; 2048];
let mut digits_left = max_digits;
for chunk in self[..max_hex].chunks(1024) {
chunk.iter().enumerate().for_each(|(i, c)| {
buf[i * 2] = UPPER_CHARS[(c >> 4) as usize];
buf[i * 2 + 1] = UPPER_CHARS[(c & 0xF) as usize];
});
let n = min(chunk.len() * 2, digits_left);
f.write_str(unsafe { str::from_utf8_unchecked(&buf[..n]) })?;
digits_left -= n;
}
}
Ok(())
}
}
//! Generic array are commonly used as a return value for hash digests, so
//! it's a good idea to allow to hexlify them easily. This module implements
//! `std::fmt::LowerHex` and `std::fmt::UpperHex` traits.
//!
//! Example:
//!
//! ```rust
//! # #[macro_use]
//! # extern crate generic_array;
//! # extern crate typenum;
//! # fn main() {
//! let array = arr![u8; 10, 20, 30];
//! assert_eq!(format!("{:x}", array), "0a141e");
//! # }
//! ```
//!
use core::{fmt, str, ops::Add, cmp::min};
use typenum::*;
use crate::{ArrayLength, GenericArray};
static LOWER_CHARS: &'static [u8] = b"0123456789abcdef";
static UPPER_CHARS: &'static [u8] = b"0123456789ABCDEF";
impl<T: ArrayLength<u8>> fmt::LowerHex for GenericArray<u8, T>
where
T: Add<T>,
<T as Add<T>>::Output: ArrayLength<u8>,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let max_digits = f.precision().unwrap_or_else(|| self.len() * 2);
let max_hex = (max_digits >> 1) + (max_digits & 1);
if T::USIZE < 1024 {
// For small arrays use a stack allocated
// buffer of 2x number of bytes
let mut res = GenericArray::<u8, Sum<T, T>>::default();
self.iter().take(max_hex).enumerate().for_each(|(i, c)| {
res[i * 2] = LOWER_CHARS[(c >> 4) as usize];
res[i * 2 + 1] = LOWER_CHARS[(c & 0xF) as usize];
});
f.write_str(unsafe { str::from_utf8_unchecked(&res[..max_digits]) })?;
} else {
// For large array use chunks of up to 1024 bytes (2048 hex chars)
let mut buf = [0u8; 2048];
let mut digits_left = max_digits;
for chunk in self[..max_hex].chunks(1024) {
chunk.iter().enumerate().for_each(|(i, c)| {
buf[i * 2] = LOWER_CHARS[(c >> 4) as usize];
buf[i * 2 + 1] = LOWER_CHARS[(c & 0xF) as usize];
});
let n = min(chunk.len() * 2, digits_left);
f.write_str(unsafe { str::from_utf8_unchecked(&buf[..n]) })?;
digits_left -= n;
}
}
Ok(())
}
}
impl<T: ArrayLength<u8>> fmt::UpperHex for GenericArray<u8, T>
where
T: Add<T>,
<T as Add<T>>::Output: ArrayLength<u8>,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let max_digits = f.precision().unwrap_or_else(|| self.len() * 2);
let max_hex = (max_digits >> 1) + (max_digits & 1);
if T::USIZE < 1024 {
// For small arrays use a stack allocated
// buffer of 2x number of bytes
let mut res = GenericArray::<u8, Sum<T, T>>::default();
self.iter().take(max_hex).enumerate().for_each(|(i, c)| {
res[i * 2] = UPPER_CHARS[(c >> 4) as usize];
res[i * 2 + 1] = UPPER_CHARS[(c & 0xF) as usize];
});
f.write_str(unsafe { str::from_utf8_unchecked(&res[..max_digits]) })?;
} else {
// For large array use chunks of up to 1024 bytes (2048 hex chars)
let mut buf = [0u8; 2048];
let mut digits_left = max_digits;
for chunk in self[..max_hex].chunks(1024) {
chunk.iter().enumerate().for_each(|(i, c)| {
buf[i * 2] = UPPER_CHARS[(c >> 4) as usize];
buf[i * 2 + 1] = UPPER_CHARS[(c & 0xF) as usize];
});
let n = min(chunk.len() * 2, digits_left);
f.write_str(unsafe { str::from_utf8_unchecked(&buf[..n]) })?;
digits_left -= n;
}
}
Ok(())
}
}

View File

@ -1,108 +1,108 @@
//! Serde serialization/deserialization implementation
use core::fmt;
use core::marker::PhantomData;
use serde::de::{self, SeqAccess, Visitor};
use serde::{ser::SerializeTuple, Deserialize, Deserializer, Serialize, Serializer};
use {ArrayLength, GenericArray};
impl<T, N> Serialize for GenericArray<T, N>
where
T: Serialize,
N: ArrayLength<T>,
{
#[inline]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let mut tup = serializer.serialize_tuple(N::USIZE)?;
for el in self {
tup.serialize_element(el)?;
}
tup.end()
}
}
struct GAVisitor<T, N> {
_t: PhantomData<T>,
_n: PhantomData<N>,
}
impl<'de, T, N> Visitor<'de> for GAVisitor<T, N>
where
T: Deserialize<'de> + Default,
N: ArrayLength<T>,
{
type Value = GenericArray<T, N>;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("struct GenericArray")
}
fn visit_seq<A>(self, mut seq: A) -> Result<GenericArray<T, N>, A::Error>
where
A: SeqAccess<'de>,
{
let mut result = GenericArray::default();
for i in 0..N::USIZE {
result[i] = seq
.next_element()?
.ok_or_else(|| de::Error::invalid_length(i, &self))?;
}
Ok(result)
}
}
impl<'de, T, N> Deserialize<'de> for GenericArray<T, N>
where
T: Deserialize<'de> + Default,
N: ArrayLength<T>,
{
fn deserialize<D>(deserializer: D) -> Result<GenericArray<T, N>, D::Error>
where
D: Deserializer<'de>,
{
let visitor = GAVisitor {
_t: PhantomData,
_n: PhantomData,
};
deserializer.deserialize_tuple(N::USIZE, visitor)
}
}
#[cfg(test)]
mod tests {
use super::*;
use bincode;
use typenum;
#[test]
fn test_serialize() {
let array = GenericArray::<u8, typenum::U2>::default();
let serialized = bincode::serialize(&array);
assert!(serialized.is_ok());
}
#[test]
fn test_deserialize() {
let mut array = GenericArray::<u8, typenum::U2>::default();
array[0] = 1;
array[1] = 2;
let serialized = bincode::serialize(&array).unwrap();
let deserialized = bincode::deserialize::<GenericArray<u8, typenum::U2>>(&serialized);
assert!(deserialized.is_ok());
let array = deserialized.unwrap();
assert_eq!(array[0], 1);
assert_eq!(array[1], 2);
}
#[test]
fn test_serialized_size() {
let array = GenericArray::<u8, typenum::U1>::default();
let size = bincode::serialized_size(&array).unwrap();
assert_eq!(size, 1);
}
}
//! Serde serialization/deserialization implementation
use core::fmt;
use core::marker::PhantomData;
use serde::de::{self, SeqAccess, Visitor};
use serde::{ser::SerializeTuple, Deserialize, Deserializer, Serialize, Serializer};
use {ArrayLength, GenericArray};
impl<T, N> Serialize for GenericArray<T, N>
where
T: Serialize,
N: ArrayLength<T>,
{
#[inline]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let mut tup = serializer.serialize_tuple(N::USIZE)?;
for el in self {
tup.serialize_element(el)?;
}
tup.end()
}
}
struct GAVisitor<T, N> {
_t: PhantomData<T>,
_n: PhantomData<N>,
}
impl<'de, T, N> Visitor<'de> for GAVisitor<T, N>
where
T: Deserialize<'de> + Default,
N: ArrayLength<T>,
{
type Value = GenericArray<T, N>;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("struct GenericArray")
}
fn visit_seq<A>(self, mut seq: A) -> Result<GenericArray<T, N>, A::Error>
where
A: SeqAccess<'de>,
{
let mut result = GenericArray::default();
for i in 0..N::USIZE {
result[i] = seq
.next_element()?
.ok_or_else(|| de::Error::invalid_length(i, &self))?;
}
Ok(result)
}
}
impl<'de, T, N> Deserialize<'de> for GenericArray<T, N>
where
T: Deserialize<'de> + Default,
N: ArrayLength<T>,
{
fn deserialize<D>(deserializer: D) -> Result<GenericArray<T, N>, D::Error>
where
D: Deserializer<'de>,
{
let visitor = GAVisitor {
_t: PhantomData,
_n: PhantomData,
};
deserializer.deserialize_tuple(N::USIZE, visitor)
}
}
#[cfg(test)]
mod tests {
use super::*;
use bincode;
use typenum;
#[test]
fn test_serialize() {
let array = GenericArray::<u8, typenum::U2>::default();
let serialized = bincode::serialize(&array);
assert!(serialized.is_ok());
}
#[test]
fn test_deserialize() {
let mut array = GenericArray::<u8, typenum::U2>::default();
array[0] = 1;
array[1] = 2;
let serialized = bincode::serialize(&array).unwrap();
let deserialized = bincode::deserialize::<GenericArray<u8, typenum::U2>>(&serialized);
assert!(deserialized.is_ok());
let array = deserialized.unwrap();
assert_eq!(array[0], 1);
assert_eq!(array[1], 2);
}
#[test]
fn test_serialized_size() {
let array = GenericArray::<u8, typenum::U1>::default();
let size = bincode::serialized_size(&array).unwrap();
assert_eq!(size, 1);
}
}

View File

@ -1,269 +1,269 @@
use core::borrow::{Borrow, BorrowMut};
use core::cmp::Ordering;
use core::fmt::{self, Debug};
use core::hash::{Hash, Hasher};
use super::{ArrayLength, GenericArray};
use crate::functional::*;
use crate::sequence::*;
impl<T: Default, N> Default for GenericArray<T, N>
where
N: ArrayLength<T>,
{
#[inline(always)]
fn default() -> Self {
Self::generate(|_| T::default())
}
}
impl<T: Clone, N> Clone for GenericArray<T, N>
where
N: ArrayLength<T>,
{
fn clone(&self) -> GenericArray<T, N> {
self.map(Clone::clone)
}
}
impl<T: Copy, N> Copy for GenericArray<T, N>
where
N: ArrayLength<T>,
N::ArrayType: Copy,
{
}
impl<T: PartialEq, N> PartialEq for GenericArray<T, N>
where
N: ArrayLength<T>,
{
fn eq(&self, other: &Self) -> bool {
**self == **other
}
}
impl<T: Eq, N> Eq for GenericArray<T, N> where N: ArrayLength<T> {}
impl<T: PartialOrd, N> PartialOrd for GenericArray<T, N>
where
N: ArrayLength<T>,
{
fn partial_cmp(&self, other: &GenericArray<T, N>) -> Option<Ordering> {
PartialOrd::partial_cmp(self.as_slice(), other.as_slice())
}
}
impl<T: Ord, N> Ord for GenericArray<T, N>
where
N: ArrayLength<T>,
{
fn cmp(&self, other: &GenericArray<T, N>) -> Ordering {
Ord::cmp(self.as_slice(), other.as_slice())
}
}
impl<T: Debug, N> Debug for GenericArray<T, N>
where
N: ArrayLength<T>,
{
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
self[..].fmt(fmt)
}
}
impl<T, N> Borrow<[T]> for GenericArray<T, N>
where
N: ArrayLength<T>,
{
#[inline(always)]
fn borrow(&self) -> &[T] {
&self[..]
}
}
impl<T, N> BorrowMut<[T]> for GenericArray<T, N>
where
N: ArrayLength<T>,
{
#[inline(always)]
fn borrow_mut(&mut self) -> &mut [T] {
&mut self[..]
}
}
impl<T, N> AsRef<[T]> for GenericArray<T, N>
where
N: ArrayLength<T>,
{
#[inline(always)]
fn as_ref(&self) -> &[T] {
&self[..]
}
}
impl<T, N> AsMut<[T]> for GenericArray<T, N>
where
N: ArrayLength<T>,
{
#[inline(always)]
fn as_mut(&mut self) -> &mut [T] {
&mut self[..]
}
}
impl<T: Hash, N> Hash for GenericArray<T, N>
where
N: ArrayLength<T>,
{
fn hash<H>(&self, state: &mut H)
where
H: Hasher,
{
Hash::hash(&self[..], state)
}
}
macro_rules! impl_from {
($($n: expr => $ty: ty),*) => {
$(
impl<T> From<[T; $n]> for GenericArray<T, $ty> {
#[inline(always)]
fn from(arr: [T; $n]) -> Self {
unsafe { $crate::transmute(arr) }
}
}
#[cfg(relaxed_coherence)]
impl<T> From<GenericArray<T, $ty>> for [T; $n] {
#[inline(always)]
fn from(sel: GenericArray<T, $ty>) -> [T; $n] {
unsafe { $crate::transmute(sel) }
}
}
impl<'a, T> From<&'a [T; $n]> for &'a GenericArray<T, $ty> {
#[inline]
fn from(slice: &[T; $n]) -> &GenericArray<T, $ty> {
unsafe { &*(slice.as_ptr() as *const GenericArray<T, $ty>) }
}
}
impl<'a, T> From<&'a mut [T; $n]> for &'a mut GenericArray<T, $ty> {
#[inline]
fn from(slice: &mut [T; $n]) -> &mut GenericArray<T, $ty> {
unsafe { &mut *(slice.as_mut_ptr() as *mut GenericArray<T, $ty>) }
}
}
#[cfg(not(relaxed_coherence))]
impl<T> Into<[T; $n]> for GenericArray<T, $ty> {
#[inline(always)]
fn into(self) -> [T; $n] {
unsafe { $crate::transmute(self) }
}
}
impl<T> AsRef<[T; $n]> for GenericArray<T, $ty> {
#[inline]
fn as_ref(&self) -> &[T; $n] {
unsafe { $crate::transmute(self) }
}
}
impl<T> AsMut<[T; $n]> for GenericArray<T, $ty> {
#[inline]
fn as_mut(&mut self) -> &mut [T; $n] {
unsafe { $crate::transmute(self) }
}
}
)*
}
}
impl_from! {
1 => ::typenum::U1,
2 => ::typenum::U2,
3 => ::typenum::U3,
4 => ::typenum::U4,
5 => ::typenum::U5,
6 => ::typenum::U6,
7 => ::typenum::U7,
8 => ::typenum::U8,
9 => ::typenum::U9,
10 => ::typenum::U10,
11 => ::typenum::U11,
12 => ::typenum::U12,
13 => ::typenum::U13,
14 => ::typenum::U14,
15 => ::typenum::U15,
16 => ::typenum::U16,
17 => ::typenum::U17,
18 => ::typenum::U18,
19 => ::typenum::U19,
20 => ::typenum::U20,
21 => ::typenum::U21,
22 => ::typenum::U22,
23 => ::typenum::U23,
24 => ::typenum::U24,
25 => ::typenum::U25,
26 => ::typenum::U26,
27 => ::typenum::U27,
28 => ::typenum::U28,
29 => ::typenum::U29,
30 => ::typenum::U30,
31 => ::typenum::U31,
32 => ::typenum::U32
}
#[cfg(feature = "more_lengths")]
impl_from! {
33 => ::typenum::U33,
34 => ::typenum::U34,
35 => ::typenum::U35,
36 => ::typenum::U36,
37 => ::typenum::U37,
38 => ::typenum::U38,
39 => ::typenum::U39,
40 => ::typenum::U40,
41 => ::typenum::U41,
42 => ::typenum::U42,
43 => ::typenum::U43,
44 => ::typenum::U44,
45 => ::typenum::U45,
46 => ::typenum::U46,
47 => ::typenum::U47,
48 => ::typenum::U48,
49 => ::typenum::U49,
50 => ::typenum::U50,
51 => ::typenum::U51,
52 => ::typenum::U52,
53 => ::typenum::U53,
54 => ::typenum::U54,
55 => ::typenum::U55,
56 => ::typenum::U56,
57 => ::typenum::U57,
58 => ::typenum::U58,
59 => ::typenum::U59,
60 => ::typenum::U60,
61 => ::typenum::U61,
62 => ::typenum::U62,
63 => ::typenum::U63,
64 => ::typenum::U64,
70 => ::typenum::U70,
80 => ::typenum::U80,
90 => ::typenum::U90,
100 => ::typenum::U100,
200 => ::typenum::U200,
300 => ::typenum::U300,
400 => ::typenum::U400,
500 => ::typenum::U500,
128 => ::typenum::U128,
256 => ::typenum::U256,
512 => ::typenum::U512,
1000 => ::typenum::U1000,
1024 => ::typenum::U1024
}
use core::borrow::{Borrow, BorrowMut};
use core::cmp::Ordering;
use core::fmt::{self, Debug};
use core::hash::{Hash, Hasher};
use super::{ArrayLength, GenericArray};
use crate::functional::*;
use crate::sequence::*;
impl<T: Default, N> Default for GenericArray<T, N>
where
N: ArrayLength<T>,
{
#[inline(always)]
fn default() -> Self {
Self::generate(|_| T::default())
}
}
impl<T: Clone, N> Clone for GenericArray<T, N>
where
N: ArrayLength<T>,
{
fn clone(&self) -> GenericArray<T, N> {
self.map(Clone::clone)
}
}
impl<T: Copy, N> Copy for GenericArray<T, N>
where
N: ArrayLength<T>,
N::ArrayType: Copy,
{
}
impl<T: PartialEq, N> PartialEq for GenericArray<T, N>
where
N: ArrayLength<T>,
{
fn eq(&self, other: &Self) -> bool {
**self == **other
}
}
impl<T: Eq, N> Eq for GenericArray<T, N> where N: ArrayLength<T> {}
impl<T: PartialOrd, N> PartialOrd for GenericArray<T, N>
where
N: ArrayLength<T>,
{
fn partial_cmp(&self, other: &GenericArray<T, N>) -> Option<Ordering> {
PartialOrd::partial_cmp(self.as_slice(), other.as_slice())
}
}
impl<T: Ord, N> Ord for GenericArray<T, N>
where
N: ArrayLength<T>,
{
fn cmp(&self, other: &GenericArray<T, N>) -> Ordering {
Ord::cmp(self.as_slice(), other.as_slice())
}
}
impl<T: Debug, N> Debug for GenericArray<T, N>
where
N: ArrayLength<T>,
{
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
self[..].fmt(fmt)
}
}
impl<T, N> Borrow<[T]> for GenericArray<T, N>
where
N: ArrayLength<T>,
{
#[inline(always)]
fn borrow(&self) -> &[T] {
&self[..]
}
}
impl<T, N> BorrowMut<[T]> for GenericArray<T, N>
where
N: ArrayLength<T>,
{
#[inline(always)]
fn borrow_mut(&mut self) -> &mut [T] {
&mut self[..]
}
}
impl<T, N> AsRef<[T]> for GenericArray<T, N>
where
N: ArrayLength<T>,
{
#[inline(always)]
fn as_ref(&self) -> &[T] {
&self[..]
}
}
impl<T, N> AsMut<[T]> for GenericArray<T, N>
where
N: ArrayLength<T>,
{
#[inline(always)]
fn as_mut(&mut self) -> &mut [T] {
&mut self[..]
}
}
impl<T: Hash, N> Hash for GenericArray<T, N>
where
N: ArrayLength<T>,
{
fn hash<H>(&self, state: &mut H)
where
H: Hasher,
{
Hash::hash(&self[..], state)
}
}
macro_rules! impl_from {
($($n: expr => $ty: ty),*) => {
$(
impl<T> From<[T; $n]> for GenericArray<T, $ty> {
#[inline(always)]
fn from(arr: [T; $n]) -> Self {
unsafe { $crate::transmute(arr) }
}
}
#[cfg(relaxed_coherence)]
impl<T> From<GenericArray<T, $ty>> for [T; $n] {
#[inline(always)]
fn from(sel: GenericArray<T, $ty>) -> [T; $n] {
unsafe { $crate::transmute(sel) }
}
}
impl<'a, T> From<&'a [T; $n]> for &'a GenericArray<T, $ty> {
#[inline]
fn from(slice: &[T; $n]) -> &GenericArray<T, $ty> {
unsafe { &*(slice.as_ptr() as *const GenericArray<T, $ty>) }
}
}
impl<'a, T> From<&'a mut [T; $n]> for &'a mut GenericArray<T, $ty> {
#[inline]
fn from(slice: &mut [T; $n]) -> &mut GenericArray<T, $ty> {
unsafe { &mut *(slice.as_mut_ptr() as *mut GenericArray<T, $ty>) }
}
}
#[cfg(not(relaxed_coherence))]
impl<T> Into<[T; $n]> for GenericArray<T, $ty> {
#[inline(always)]
fn into(self) -> [T; $n] {
unsafe { $crate::transmute(self) }
}
}
impl<T> AsRef<[T; $n]> for GenericArray<T, $ty> {
#[inline]
fn as_ref(&self) -> &[T; $n] {
unsafe { $crate::transmute(self) }
}
}
impl<T> AsMut<[T; $n]> for GenericArray<T, $ty> {
#[inline]
fn as_mut(&mut self) -> &mut [T; $n] {
unsafe { $crate::transmute(self) }
}
}
)*
}
}
impl_from! {
1 => ::typenum::U1,
2 => ::typenum::U2,
3 => ::typenum::U3,
4 => ::typenum::U4,
5 => ::typenum::U5,
6 => ::typenum::U6,
7 => ::typenum::U7,
8 => ::typenum::U8,
9 => ::typenum::U9,
10 => ::typenum::U10,
11 => ::typenum::U11,
12 => ::typenum::U12,
13 => ::typenum::U13,
14 => ::typenum::U14,
15 => ::typenum::U15,
16 => ::typenum::U16,
17 => ::typenum::U17,
18 => ::typenum::U18,
19 => ::typenum::U19,
20 => ::typenum::U20,
21 => ::typenum::U21,
22 => ::typenum::U22,
23 => ::typenum::U23,
24 => ::typenum::U24,
25 => ::typenum::U25,
26 => ::typenum::U26,
27 => ::typenum::U27,
28 => ::typenum::U28,
29 => ::typenum::U29,
30 => ::typenum::U30,
31 => ::typenum::U31,
32 => ::typenum::U32
}
#[cfg(feature = "more_lengths")]
impl_from! {
33 => ::typenum::U33,
34 => ::typenum::U34,
35 => ::typenum::U35,
36 => ::typenum::U36,
37 => ::typenum::U37,
38 => ::typenum::U38,
39 => ::typenum::U39,
40 => ::typenum::U40,
41 => ::typenum::U41,
42 => ::typenum::U42,
43 => ::typenum::U43,
44 => ::typenum::U44,
45 => ::typenum::U45,
46 => ::typenum::U46,
47 => ::typenum::U47,
48 => ::typenum::U48,
49 => ::typenum::U49,
50 => ::typenum::U50,
51 => ::typenum::U51,
52 => ::typenum::U52,
53 => ::typenum::U53,
54 => ::typenum::U54,
55 => ::typenum::U55,
56 => ::typenum::U56,
57 => ::typenum::U57,
58 => ::typenum::U58,
59 => ::typenum::U59,
60 => ::typenum::U60,
61 => ::typenum::U61,
62 => ::typenum::U62,
63 => ::typenum::U63,
64 => ::typenum::U64,
70 => ::typenum::U70,
80 => ::typenum::U80,
90 => ::typenum::U90,
100 => ::typenum::U100,
200 => ::typenum::U200,
300 => ::typenum::U300,
400 => ::typenum::U400,
500 => ::typenum::U500,
128 => ::typenum::U128,
256 => ::typenum::U256,
512 => ::typenum::U512,
1000 => ::typenum::U1000,
1024 => ::typenum::U1024
}

View File

@ -1,256 +1,256 @@
//! `GenericArray` iterator implementation.
use super::{ArrayLength, GenericArray};
use core::iter::FusedIterator;
use core::mem::ManuallyDrop;
use core::{cmp, fmt, ptr, mem};
/// An iterator that moves out of a `GenericArray`
pub struct GenericArrayIter<T, N: ArrayLength<T>> {
// Invariants: index <= index_back <= N
// Only values in array[index..index_back] are alive at any given time.
// Values from array[..index] and array[index_back..] are already moved/dropped.
array: ManuallyDrop<GenericArray<T, N>>,
index: usize,
index_back: usize,
}
#[cfg(test)]
mod test {
use super::*;
fn send<I: Send>(_iter: I) {}
#[test]
fn test_send_iter() {
send(GenericArray::from([1, 2, 3, 4]).into_iter());
}
}
impl<T, N> GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
/// Returns the remaining items of this iterator as a slice
#[inline]
pub fn as_slice(&self) -> &[T] {
&self.array.as_slice()[self.index..self.index_back]
}
/// Returns the remaining items of this iterator as a mutable slice
#[inline]
pub fn as_mut_slice(&mut self) -> &mut [T] {
&mut self.array.as_mut_slice()[self.index..self.index_back]
}
}
impl<T, N> IntoIterator for GenericArray<T, N>
where
N: ArrayLength<T>,
{
type Item = T;
type IntoIter = GenericArrayIter<T, N>;
fn into_iter(self) -> Self::IntoIter {
GenericArrayIter {
array: ManuallyDrop::new(self),
index: 0,
index_back: N::USIZE,
}
}
}
// Based on work in rust-lang/rust#49000
impl<T: fmt::Debug, N> fmt::Debug for GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("GenericArrayIter")
.field(&self.as_slice())
.finish()
}
}
impl<T, N> Drop for GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
#[inline]
fn drop(&mut self) {
if mem::needs_drop::<T>() {
// Drop values that are still alive.
for p in self.as_mut_slice() {
unsafe {
ptr::drop_in_place(p);
}
}
}
}
}
// Based on work in rust-lang/rust#49000
impl<T: Clone, N> Clone for GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
fn clone(&self) -> Self {
// This places all cloned elements at the start of the new array iterator,
// not at their original indices.
unsafe {
let mut array = ptr::read(&self.array);
let mut index_back = 0;
for (dst, src) in array.as_mut_slice().into_iter().zip(self.as_slice()) {
ptr::write(dst, src.clone());
index_back += 1;
}
GenericArrayIter {
array,
index: 0,
index_back
}
}
}
}
impl<T, N> Iterator for GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
type Item = T;
#[inline]
fn next(&mut self) -> Option<T> {
if self.index < self.index_back {
let p = unsafe { Some(ptr::read(self.array.get_unchecked(self.index))) };
self.index += 1;
p
} else {
None
}
}
fn fold<B, F>(mut self, init: B, mut f: F) -> B
where
F: FnMut(B, Self::Item) -> B,
{
let ret = unsafe {
let GenericArrayIter {
ref array,
ref mut index,
index_back,
} = self;
let remaining = &array[*index..index_back];
remaining.iter().fold(init, |acc, src| {
let value = ptr::read(src);
*index += 1;
f(acc, value)
})
};
// ensure the drop happens here after iteration
drop(self);
ret
}
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let len = self.len();
(len, Some(len))
}
#[inline]
fn count(self) -> usize {
self.len()
}
fn nth(&mut self, n: usize) -> Option<T> {
// First consume values prior to the nth.
let ndrop = cmp::min(n, self.len());
for p in &mut self.array[self.index..self.index + ndrop] {
self.index += 1;
unsafe {
ptr::drop_in_place(p);
}
}
self.next()
}
#[inline]
fn last(mut self) -> Option<T> {
// Note, everything else will correctly drop first as `self` leaves scope.
self.next_back()
}
}
impl<T, N> DoubleEndedIterator for GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
fn next_back(&mut self) -> Option<T> {
if self.index < self.index_back {
self.index_back -= 1;
unsafe { Some(ptr::read(self.array.get_unchecked(self.index_back))) }
} else {
None
}
}
fn rfold<B, F>(mut self, init: B, mut f: F) -> B
where
F: FnMut(B, Self::Item) -> B,
{
let ret = unsafe {
let GenericArrayIter {
ref array,
index,
ref mut index_back,
} = self;
let remaining = &array[index..*index_back];
remaining.iter().rfold(init, |acc, src| {
let value = ptr::read(src);
*index_back -= 1;
f(acc, value)
})
};
// ensure the drop happens here after iteration
drop(self);
ret
}
}
impl<T, N> ExactSizeIterator for GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
fn len(&self) -> usize {
self.index_back - self.index
}
}
impl<T, N> FusedIterator for GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
}
// TODO: Implement `TrustedLen` when stabilized
//! `GenericArray` iterator implementation.
use super::{ArrayLength, GenericArray};
use core::iter::FusedIterator;
use core::mem::ManuallyDrop;
use core::{cmp, fmt, ptr, mem};
/// An iterator that moves out of a `GenericArray`
pub struct GenericArrayIter<T, N: ArrayLength<T>> {
// Invariants: index <= index_back <= N
// Only values in array[index..index_back] are alive at any given time.
// Values from array[..index] and array[index_back..] are already moved/dropped.
array: ManuallyDrop<GenericArray<T, N>>,
index: usize,
index_back: usize,
}
#[cfg(test)]
mod test {
use super::*;
fn send<I: Send>(_iter: I) {}
#[test]
fn test_send_iter() {
send(GenericArray::from([1, 2, 3, 4]).into_iter());
}
}
impl<T, N> GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
/// Returns the remaining items of this iterator as a slice
#[inline]
pub fn as_slice(&self) -> &[T] {
&self.array.as_slice()[self.index..self.index_back]
}
/// Returns the remaining items of this iterator as a mutable slice
#[inline]
pub fn as_mut_slice(&mut self) -> &mut [T] {
&mut self.array.as_mut_slice()[self.index..self.index_back]
}
}
impl<T, N> IntoIterator for GenericArray<T, N>
where
N: ArrayLength<T>,
{
type Item = T;
type IntoIter = GenericArrayIter<T, N>;
fn into_iter(self) -> Self::IntoIter {
GenericArrayIter {
array: ManuallyDrop::new(self),
index: 0,
index_back: N::USIZE,
}
}
}
// Based on work in rust-lang/rust#49000
impl<T: fmt::Debug, N> fmt::Debug for GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("GenericArrayIter")
.field(&self.as_slice())
.finish()
}
}
impl<T, N> Drop for GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
#[inline]
fn drop(&mut self) {
if mem::needs_drop::<T>() {
// Drop values that are still alive.
for p in self.as_mut_slice() {
unsafe {
ptr::drop_in_place(p);
}
}
}
}
}
// Based on work in rust-lang/rust#49000
impl<T: Clone, N> Clone for GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
fn clone(&self) -> Self {
// This places all cloned elements at the start of the new array iterator,
// not at their original indices.
unsafe {
let mut array = ptr::read(&self.array);
let mut index_back = 0;
for (dst, src) in array.as_mut_slice().into_iter().zip(self.as_slice()) {
ptr::write(dst, src.clone());
index_back += 1;
}
GenericArrayIter {
array,
index: 0,
index_back
}
}
}
}
impl<T, N> Iterator for GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
type Item = T;
#[inline]
fn next(&mut self) -> Option<T> {
if self.index < self.index_back {
let p = unsafe { Some(ptr::read(self.array.get_unchecked(self.index))) };
self.index += 1;
p
} else {
None
}
}
fn fold<B, F>(mut self, init: B, mut f: F) -> B
where
F: FnMut(B, Self::Item) -> B,
{
let ret = unsafe {
let GenericArrayIter {
ref array,
ref mut index,
index_back,
} = self;
let remaining = &array[*index..index_back];
remaining.iter().fold(init, |acc, src| {
let value = ptr::read(src);
*index += 1;
f(acc, value)
})
};
// ensure the drop happens here after iteration
drop(self);
ret
}
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let len = self.len();
(len, Some(len))
}
#[inline]
fn count(self) -> usize {
self.len()
}
fn nth(&mut self, n: usize) -> Option<T> {
// First consume values prior to the nth.
let ndrop = cmp::min(n, self.len());
for p in &mut self.array[self.index..self.index + ndrop] {
self.index += 1;
unsafe {
ptr::drop_in_place(p);
}
}
self.next()
}
#[inline]
fn last(mut self) -> Option<T> {
// Note, everything else will correctly drop first as `self` leaves scope.
self.next_back()
}
}
impl<T, N> DoubleEndedIterator for GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
fn next_back(&mut self) -> Option<T> {
if self.index < self.index_back {
self.index_back -= 1;
unsafe { Some(ptr::read(self.array.get_unchecked(self.index_back))) }
} else {
None
}
}
fn rfold<B, F>(mut self, init: B, mut f: F) -> B
where
F: FnMut(B, Self::Item) -> B,
{
let ret = unsafe {
let GenericArrayIter {
ref array,
index,
ref mut index_back,
} = self;
let remaining = &array[index..*index_back];
remaining.iter().rfold(init, |acc, src| {
let value = ptr::read(src);
*index_back -= 1;
f(acc, value)
})
};
// ensure the drop happens here after iteration
drop(self);
ret
}
}
impl<T, N> ExactSizeIterator for GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
fn len(&self) -> usize {
self.index_back - self.index
}
}
impl<T, N> FusedIterator for GenericArrayIter<T, N>
where
N: ArrayLength<T>,
{
}
// TODO: Implement `TrustedLen` when stabilized

File diff suppressed because it is too large Load Diff

View File

@ -1,380 +1,380 @@
//! Useful traits for manipulating sequences of data stored in `GenericArray`s
use super::*;
use core::ops::{Add, Sub};
use core::mem::MaybeUninit;
use core::ptr;
use typenum::operator_aliases::*;
/// Defines some sequence with an associated length and iteration capabilities.
///
/// This is useful for passing N-length generic arrays as generics.
pub unsafe trait GenericSequence<T>: Sized + IntoIterator {
/// `GenericArray` associated length
type Length: ArrayLength<T>;
/// Concrete sequence type used in conjuction with reference implementations of `GenericSequence`
type Sequence: GenericSequence<T, Length = Self::Length> + FromIterator<T>;
/// Initializes a new sequence instance using the given function.
///
/// If the generator function panics while initializing the sequence,
/// any already initialized elements will be dropped.
fn generate<F>(f: F) -> Self::Sequence
where
F: FnMut(usize) -> T;
#[doc(hidden)]
fn inverted_zip<B, U, F>(
self,
lhs: GenericArray<B, Self::Length>,
mut f: F,
) -> MappedSequence<GenericArray<B, Self::Length>, B, U>
where
GenericArray<B, Self::Length>: GenericSequence<B, Length = Self::Length>
+ MappedGenericSequence<B, U>,
Self: MappedGenericSequence<T, U>,
Self::Length: ArrayLength<B> + ArrayLength<U>,
F: FnMut(B, Self::Item) -> U,
{
unsafe {
let mut left = ArrayConsumer::new(lhs);
let (left_array_iter, left_position) = left.iter_position();
FromIterator::from_iter(left_array_iter.zip(self.into_iter()).map(
|(l, right_value)| {
let left_value = ptr::read(l);
*left_position += 1;
f(left_value, right_value)
},
))
}
}
#[doc(hidden)]
fn inverted_zip2<B, Lhs, U, F>(self, lhs: Lhs, mut f: F) -> MappedSequence<Lhs, B, U>
where
Lhs: GenericSequence<B, Length = Self::Length> + MappedGenericSequence<B, U>,
Self: MappedGenericSequence<T, U>,
Self::Length: ArrayLength<B> + ArrayLength<U>,
F: FnMut(Lhs::Item, Self::Item) -> U,
{
FromIterator::from_iter(lhs.into_iter().zip(self.into_iter()).map(|(l, r)| f(l, r)))
}
}
/// Accessor for `GenericSequence` item type, which is really `IntoIterator::Item`
///
/// For deeply nested generic mapped sequence types, like shown in `tests/generics.rs`,
/// this can be useful for keeping things organized.
pub type SequenceItem<T> = <T as IntoIterator>::Item;
unsafe impl<'a, T: 'a, S: GenericSequence<T>> GenericSequence<T> for &'a S
where
&'a S: IntoIterator,
{
type Length = S::Length;
type Sequence = S::Sequence;
#[inline]
fn generate<F>(f: F) -> Self::Sequence
where
F: FnMut(usize) -> T,
{
S::generate(f)
}
}
unsafe impl<'a, T: 'a, S: GenericSequence<T>> GenericSequence<T> for &'a mut S
where
&'a mut S: IntoIterator,
{
type Length = S::Length;
type Sequence = S::Sequence;
#[inline]
fn generate<F>(f: F) -> Self::Sequence
where
F: FnMut(usize) -> T,
{
S::generate(f)
}
}
/// Defines any `GenericSequence` which can be lengthened or extended by appending
/// or prepending an element to it.
///
/// Any lengthened sequence can be shortened back to the original using `pop_front` or `pop_back`
pub unsafe trait Lengthen<T>: Sized + GenericSequence<T> {
/// `GenericSequence` that has one more element than `Self`
type Longer: Shorten<T, Shorter = Self>;
/// Returns a new array with the given element appended to the end of it.
///
/// Example:
///
/// ```rust
/// # use generic_array::{arr, sequence::Lengthen};
/// # fn main() {
/// let a = arr![i32; 1, 2, 3];
///
/// let b = a.append(4);
///
/// assert_eq!(b, arr![i32; 1, 2, 3, 4]);
/// # }
/// ```
fn append(self, last: T) -> Self::Longer;
/// Returns a new array with the given element prepended to the front of it.
///
/// Example:
///
/// ```rust
/// # use generic_array::{arr, sequence::Lengthen};
/// # fn main() {
/// let a = arr![i32; 1, 2, 3];
///
/// let b = a.prepend(4);
///
/// assert_eq!(b, arr![i32; 4, 1, 2, 3]);
/// # }
/// ```
fn prepend(self, first: T) -> Self::Longer;
}
/// Defines a `GenericSequence` which can be shortened by removing the first or last element from it.
///
/// Additionally, any shortened sequence can be lengthened by
/// appending or prepending an element to it.
pub unsafe trait Shorten<T>: Sized + GenericSequence<T> {
/// `GenericSequence` that has one less element than `Self`
type Shorter: Lengthen<T, Longer = Self>;
/// Returns a new array without the last element, and the last element.
///
/// Example:
///
/// ```rust
/// # use generic_array::{arr, sequence::Shorten};
/// # fn main() {
/// let a = arr![i32; 1, 2, 3, 4];
///
/// let (init, last) = a.pop_back();
///
/// assert_eq!(init, arr![i32; 1, 2, 3]);
/// assert_eq!(last, 4);
/// # }
/// ```
fn pop_back(self) -> (Self::Shorter, T);
/// Returns a new array without the first element, and the first element.
/// Example:
///
/// ```rust
/// # use generic_array::{arr, sequence::Shorten};
/// # fn main() {
/// let a = arr![i32; 1, 2, 3, 4];
///
/// let (head, tail) = a.pop_front();
///
/// assert_eq!(head, 1);
/// assert_eq!(tail, arr![i32; 2, 3, 4]);
/// # }
/// ```
fn pop_front(self) -> (T, Self::Shorter);
}
unsafe impl<T, N: ArrayLength<T>> Lengthen<T> for GenericArray<T, N>
where
N: Add<B1>,
Add1<N>: ArrayLength<T>,
Add1<N>: Sub<B1, Output = N>,
Sub1<Add1<N>>: ArrayLength<T>,
{
type Longer = GenericArray<T, Add1<N>>;
fn append(self, last: T) -> Self::Longer {
let mut longer: MaybeUninit<Self::Longer> = MaybeUninit::uninit();
// Note this is *mut Self, so add(1) increments by the whole array
let out_ptr = longer.as_mut_ptr() as *mut Self;
unsafe {
// write self first
ptr::write(out_ptr, self);
// increment past self, then write the last
ptr::write(out_ptr.add(1) as *mut T, last);
longer.assume_init()
}
}
fn prepend(self, first: T) -> Self::Longer {
let mut longer: MaybeUninit<Self::Longer> = MaybeUninit::uninit();
// Note this is *mut T, so add(1) increments by a single T
let out_ptr = longer.as_mut_ptr() as *mut T;
unsafe {
// write the first at the start
ptr::write(out_ptr, first);
// increment past the first, then write self
ptr::write(out_ptr.add(1) as *mut Self, self);
longer.assume_init()
}
}
}
unsafe impl<T, N: ArrayLength<T>> Shorten<T> for GenericArray<T, N>
where
N: Sub<B1>,
Sub1<N>: ArrayLength<T>,
Sub1<N>: Add<B1, Output = N>,
Add1<Sub1<N>>: ArrayLength<T>,
{
type Shorter = GenericArray<T, Sub1<N>>;
fn pop_back(self) -> (Self::Shorter, T) {
let whole = ManuallyDrop::new(self);
unsafe {
let init = ptr::read(whole.as_ptr() as _);
let last = ptr::read(whole.as_ptr().add(Sub1::<N>::USIZE) as _);
(init, last)
}
}
fn pop_front(self) -> (T, Self::Shorter) {
// ensure this doesn't get dropped
let whole = ManuallyDrop::new(self);
unsafe {
let head = ptr::read(whole.as_ptr() as _);
let tail = ptr::read(whole.as_ptr().offset(1) as _);
(head, tail)
}
}
}
/// Defines a `GenericSequence` that can be split into two parts at a given pivot index.
pub unsafe trait Split<T, K>: GenericSequence<T>
where
K: ArrayLength<T>,
{
/// First part of the resulting split array
type First: GenericSequence<T>;
/// Second part of the resulting split array
type Second: GenericSequence<T>;
/// Splits an array at the given index, returning the separate parts of the array.
fn split(self) -> (Self::First, Self::Second);
}
unsafe impl<T, N, K> Split<T, K> for GenericArray<T, N>
where
N: ArrayLength<T>,
K: ArrayLength<T>,
N: Sub<K>,
Diff<N, K>: ArrayLength<T>,
{
type First = GenericArray<T, K>;
type Second = GenericArray<T, Diff<N, K>>;
fn split(self) -> (Self::First, Self::Second) {
unsafe {
// ensure this doesn't get dropped
let whole = ManuallyDrop::new(self);
let head = ptr::read(whole.as_ptr() as *const _);
let tail = ptr::read(whole.as_ptr().add(K::USIZE) as *const _);
(head, tail)
}
}
}
unsafe impl<'a, T, N, K> Split<T, K> for &'a GenericArray<T, N>
where
N: ArrayLength<T>,
K: ArrayLength<T> + 'static,
N: Sub<K>,
Diff<N, K>: ArrayLength<T>,
{
type First = &'a GenericArray<T, K>;
type Second = &'a GenericArray<T, Diff<N, K>>;
fn split(self) -> (Self::First, Self::Second) {
unsafe {
let ptr_to_first: *const T = self.as_ptr();
let head = &*(ptr_to_first as *const _);
let tail = &*(ptr_to_first.add(K::USIZE) as *const _);
(head, tail)
}
}
}
unsafe impl<'a, T, N, K> Split<T, K> for &'a mut GenericArray<T, N>
where
N: ArrayLength<T>,
K: ArrayLength<T> + 'static,
N: Sub<K>,
Diff<N, K>: ArrayLength<T>,
{
type First = &'a mut GenericArray<T, K>;
type Second = &'a mut GenericArray<T, Diff<N, K>>;
fn split(self) -> (Self::First, Self::Second) {
unsafe {
let ptr_to_first: *mut T = self.as_mut_ptr();
let head = &mut *(ptr_to_first as *mut _);
let tail = &mut *(ptr_to_first.add(K::USIZE) as *mut _);
(head, tail)
}
}
}
/// Defines `GenericSequence`s which can be joined together, forming a larger array.
pub unsafe trait Concat<T, M>: GenericSequence<T>
where
M: ArrayLength<T>,
{
/// Sequence to be concatenated with `self`
type Rest: GenericSequence<T, Length = M>;
/// Resulting sequence formed by the concatenation.
type Output: GenericSequence<T>;
/// Concatenate, or join, two sequences.
fn concat(self, rest: Self::Rest) -> Self::Output;
}
unsafe impl<T, N, M> Concat<T, M> for GenericArray<T, N>
where
N: ArrayLength<T> + Add<M>,
M: ArrayLength<T>,
Sum<N, M>: ArrayLength<T>,
{
type Rest = GenericArray<T, M>;
type Output = GenericArray<T, Sum<N, M>>;
fn concat(self, rest: Self::Rest) -> Self::Output {
let mut output: MaybeUninit<Self::Output> = MaybeUninit::uninit();
let out_ptr = output.as_mut_ptr() as *mut Self;
unsafe {
// write all of self to the pointer
ptr::write(out_ptr, self);
// increment past self, then write the rest
ptr::write(out_ptr.add(1) as *mut _, rest);
output.assume_init()
}
}
}
//! Useful traits for manipulating sequences of data stored in `GenericArray`s
use super::*;
use core::ops::{Add, Sub};
use core::mem::MaybeUninit;
use core::ptr;
use typenum::operator_aliases::*;
/// Defines some sequence with an associated length and iteration capabilities.
///
/// This is useful for passing N-length generic arrays as generics.
pub unsafe trait GenericSequence<T>: Sized + IntoIterator {
/// `GenericArray` associated length
type Length: ArrayLength<T>;
/// Concrete sequence type used in conjuction with reference implementations of `GenericSequence`
type Sequence: GenericSequence<T, Length = Self::Length> + FromIterator<T>;
/// Initializes a new sequence instance using the given function.
///
/// If the generator function panics while initializing the sequence,
/// any already initialized elements will be dropped.
fn generate<F>(f: F) -> Self::Sequence
where
F: FnMut(usize) -> T;
#[doc(hidden)]
fn inverted_zip<B, U, F>(
self,
lhs: GenericArray<B, Self::Length>,
mut f: F,
) -> MappedSequence<GenericArray<B, Self::Length>, B, U>
where
GenericArray<B, Self::Length>: GenericSequence<B, Length = Self::Length>
+ MappedGenericSequence<B, U>,
Self: MappedGenericSequence<T, U>,
Self::Length: ArrayLength<B> + ArrayLength<U>,
F: FnMut(B, Self::Item) -> U,
{
unsafe {
let mut left = ArrayConsumer::new(lhs);
let (left_array_iter, left_position) = left.iter_position();
FromIterator::from_iter(left_array_iter.zip(self.into_iter()).map(
|(l, right_value)| {
let left_value = ptr::read(l);
*left_position += 1;
f(left_value, right_value)
},
))
}
}
#[doc(hidden)]
fn inverted_zip2<B, Lhs, U, F>(self, lhs: Lhs, mut f: F) -> MappedSequence<Lhs, B, U>
where
Lhs: GenericSequence<B, Length = Self::Length> + MappedGenericSequence<B, U>,
Self: MappedGenericSequence<T, U>,
Self::Length: ArrayLength<B> + ArrayLength<U>,
F: FnMut(Lhs::Item, Self::Item) -> U,
{
FromIterator::from_iter(lhs.into_iter().zip(self.into_iter()).map(|(l, r)| f(l, r)))
}
}
/// Accessor for `GenericSequence` item type, which is really `IntoIterator::Item`
///
/// For deeply nested generic mapped sequence types, like shown in `tests/generics.rs`,
/// this can be useful for keeping things organized.
pub type SequenceItem<T> = <T as IntoIterator>::Item;
unsafe impl<'a, T: 'a, S: GenericSequence<T>> GenericSequence<T> for &'a S
where
&'a S: IntoIterator,
{
type Length = S::Length;
type Sequence = S::Sequence;
#[inline]
fn generate<F>(f: F) -> Self::Sequence
where
F: FnMut(usize) -> T,
{
S::generate(f)
}
}
unsafe impl<'a, T: 'a, S: GenericSequence<T>> GenericSequence<T> for &'a mut S
where
&'a mut S: IntoIterator,
{
type Length = S::Length;
type Sequence = S::Sequence;
#[inline]
fn generate<F>(f: F) -> Self::Sequence
where
F: FnMut(usize) -> T,
{
S::generate(f)
}
}
/// Defines any `GenericSequence` which can be lengthened or extended by appending
/// or prepending an element to it.
///
/// Any lengthened sequence can be shortened back to the original using `pop_front` or `pop_back`
pub unsafe trait Lengthen<T>: Sized + GenericSequence<T> {
/// `GenericSequence` that has one more element than `Self`
type Longer: Shorten<T, Shorter = Self>;
/// Returns a new array with the given element appended to the end of it.
///
/// Example:
///
/// ```rust
/// # use generic_array::{arr, sequence::Lengthen};
/// # fn main() {
/// let a = arr![i32; 1, 2, 3];
///
/// let b = a.append(4);
///
/// assert_eq!(b, arr![i32; 1, 2, 3, 4]);
/// # }
/// ```
fn append(self, last: T) -> Self::Longer;
/// Returns a new array with the given element prepended to the front of it.
///
/// Example:
///
/// ```rust
/// # use generic_array::{arr, sequence::Lengthen};
/// # fn main() {
/// let a = arr![i32; 1, 2, 3];
///
/// let b = a.prepend(4);
///
/// assert_eq!(b, arr![i32; 4, 1, 2, 3]);
/// # }
/// ```
fn prepend(self, first: T) -> Self::Longer;
}
/// Defines a `GenericSequence` which can be shortened by removing the first or last element from it.
///
/// Additionally, any shortened sequence can be lengthened by
/// appending or prepending an element to it.
pub unsafe trait Shorten<T>: Sized + GenericSequence<T> {
/// `GenericSequence` that has one less element than `Self`
type Shorter: Lengthen<T, Longer = Self>;
/// Returns a new array without the last element, and the last element.
///
/// Example:
///
/// ```rust
/// # use generic_array::{arr, sequence::Shorten};
/// # fn main() {
/// let a = arr![i32; 1, 2, 3, 4];
///
/// let (init, last) = a.pop_back();
///
/// assert_eq!(init, arr![i32; 1, 2, 3]);
/// assert_eq!(last, 4);
/// # }
/// ```
fn pop_back(self) -> (Self::Shorter, T);
/// Returns a new array without the first element, and the first element.
/// Example:
///
/// ```rust
/// # use generic_array::{arr, sequence::Shorten};
/// # fn main() {
/// let a = arr![i32; 1, 2, 3, 4];
///
/// let (head, tail) = a.pop_front();
///
/// assert_eq!(head, 1);
/// assert_eq!(tail, arr![i32; 2, 3, 4]);
/// # }
/// ```
fn pop_front(self) -> (T, Self::Shorter);
}
unsafe impl<T, N: ArrayLength<T>> Lengthen<T> for GenericArray<T, N>
where
N: Add<B1>,
Add1<N>: ArrayLength<T>,
Add1<N>: Sub<B1, Output = N>,
Sub1<Add1<N>>: ArrayLength<T>,
{
type Longer = GenericArray<T, Add1<N>>;
fn append(self, last: T) -> Self::Longer {
let mut longer: MaybeUninit<Self::Longer> = MaybeUninit::uninit();
// Note this is *mut Self, so add(1) increments by the whole array
let out_ptr = longer.as_mut_ptr() as *mut Self;
unsafe {
// write self first
ptr::write(out_ptr, self);
// increment past self, then write the last
ptr::write(out_ptr.add(1) as *mut T, last);
longer.assume_init()
}
}
fn prepend(self, first: T) -> Self::Longer {
let mut longer: MaybeUninit<Self::Longer> = MaybeUninit::uninit();
// Note this is *mut T, so add(1) increments by a single T
let out_ptr = longer.as_mut_ptr() as *mut T;
unsafe {
// write the first at the start
ptr::write(out_ptr, first);
// increment past the first, then write self
ptr::write(out_ptr.add(1) as *mut Self, self);
longer.assume_init()
}
}
}
unsafe impl<T, N: ArrayLength<T>> Shorten<T> for GenericArray<T, N>
where
N: Sub<B1>,
Sub1<N>: ArrayLength<T>,
Sub1<N>: Add<B1, Output = N>,
Add1<Sub1<N>>: ArrayLength<T>,
{
type Shorter = GenericArray<T, Sub1<N>>;
fn pop_back(self) -> (Self::Shorter, T) {
let whole = ManuallyDrop::new(self);
unsafe {
let init = ptr::read(whole.as_ptr() as _);
let last = ptr::read(whole.as_ptr().add(Sub1::<N>::USIZE) as _);
(init, last)
}
}
fn pop_front(self) -> (T, Self::Shorter) {
// ensure this doesn't get dropped
let whole = ManuallyDrop::new(self);
unsafe {
let head = ptr::read(whole.as_ptr() as _);
let tail = ptr::read(whole.as_ptr().offset(1) as _);
(head, tail)
}
}
}
/// Defines a `GenericSequence` that can be split into two parts at a given pivot index.
pub unsafe trait Split<T, K>: GenericSequence<T>
where
K: ArrayLength<T>,
{
/// First part of the resulting split array
type First: GenericSequence<T>;
/// Second part of the resulting split array
type Second: GenericSequence<T>;
/// Splits an array at the given index, returning the separate parts of the array.
fn split(self) -> (Self::First, Self::Second);
}
unsafe impl<T, N, K> Split<T, K> for GenericArray<T, N>
where
N: ArrayLength<T>,
K: ArrayLength<T>,
N: Sub<K>,
Diff<N, K>: ArrayLength<T>,
{
type First = GenericArray<T, K>;
type Second = GenericArray<T, Diff<N, K>>;
fn split(self) -> (Self::First, Self::Second) {
unsafe {
// ensure this doesn't get dropped
let whole = ManuallyDrop::new(self);
let head = ptr::read(whole.as_ptr() as *const _);
let tail = ptr::read(whole.as_ptr().add(K::USIZE) as *const _);
(head, tail)
}
}
}
unsafe impl<'a, T, N, K> Split<T, K> for &'a GenericArray<T, N>
where
N: ArrayLength<T>,
K: ArrayLength<T> + 'static,
N: Sub<K>,
Diff<N, K>: ArrayLength<T>,
{
type First = &'a GenericArray<T, K>;
type Second = &'a GenericArray<T, Diff<N, K>>;
fn split(self) -> (Self::First, Self::Second) {
unsafe {
let ptr_to_first: *const T = self.as_ptr();
let head = &*(ptr_to_first as *const _);
let tail = &*(ptr_to_first.add(K::USIZE) as *const _);
(head, tail)
}
}
}
unsafe impl<'a, T, N, K> Split<T, K> for &'a mut GenericArray<T, N>
where
N: ArrayLength<T>,
K: ArrayLength<T> + 'static,
N: Sub<K>,
Diff<N, K>: ArrayLength<T>,
{
type First = &'a mut GenericArray<T, K>;
type Second = &'a mut GenericArray<T, Diff<N, K>>;
fn split(self) -> (Self::First, Self::Second) {
unsafe {
let ptr_to_first: *mut T = self.as_mut_ptr();
let head = &mut *(ptr_to_first as *mut _);
let tail = &mut *(ptr_to_first.add(K::USIZE) as *mut _);
(head, tail)
}
}
}
/// Defines `GenericSequence`s which can be joined together, forming a larger array.
pub unsafe trait Concat<T, M>: GenericSequence<T>
where
M: ArrayLength<T>,
{
/// Sequence to be concatenated with `self`
type Rest: GenericSequence<T, Length = M>;
/// Resulting sequence formed by the concatenation.
type Output: GenericSequence<T>;
/// Concatenate, or join, two sequences.
fn concat(self, rest: Self::Rest) -> Self::Output;
}
unsafe impl<T, N, M> Concat<T, M> for GenericArray<T, N>
where
N: ArrayLength<T> + Add<M>,
M: ArrayLength<T>,
Sum<N, M>: ArrayLength<T>,
{
type Rest = GenericArray<T, M>;
type Output = GenericArray<T, Sum<N, M>>;
fn concat(self, rest: Self::Rest) -> Self::Output {
let mut output: MaybeUninit<Self::Output> = MaybeUninit::uninit();
let out_ptr = output.as_mut_ptr() as *mut Self;
unsafe {
// write all of self to the pointer
ptr::write(out_ptr, self);
// increment past self, then write the rest
ptr::write(out_ptr.add(1) as *mut _, rest);
output.assume_init()
}
}
}

View File

@ -1,27 +1,27 @@
#[macro_use]
extern crate generic_array;
extern crate typenum;
#[test]
fn empty_without_trailing_comma() {
let ar = arr![u8; ];
assert_eq!(format!("{:x}", ar), "");
}
#[test]
fn empty_with_trailing_comma() {
let ar = arr![u8; , ];
assert_eq!(format!("{:x}", ar), "");
}
#[test]
fn without_trailing_comma() {
let ar = arr![u8; 10, 20, 30];
assert_eq!(format!("{:x}", ar), "0a141e");
}
#[test]
fn with_trailing_comma() {
let ar = arr![u8; 10, 20, 30, ];
assert_eq!(format!("{:x}", ar), "0a141e");
}
#[macro_use]
extern crate generic_array;
extern crate typenum;
#[test]
fn empty_without_trailing_comma() {
let ar = arr![u8; ];
assert_eq!(format!("{:x}", ar), "");
}
#[test]
fn empty_with_trailing_comma() {
let ar = arr![u8; , ];
assert_eq!(format!("{:x}", ar), "");
}
#[test]
fn without_trailing_comma() {
let ar = arr![u8; 10, 20, 30];
assert_eq!(format!("{:x}", ar), "0a141e");
}
#[test]
fn with_trailing_comma() {
let ar = arr![u8; 10, 20, 30, ];
assert_eq!(format!("{:x}", ar), "0a141e");
}

View File

@ -1,98 +1,98 @@
#![recursion_limit = "128"]
#[macro_use]
extern crate generic_array;
use generic_array::typenum::consts::U4;
use std::fmt::Debug;
use std::ops::Add;
use generic_array::{GenericArray, ArrayLength};
use generic_array::sequence::*;
use generic_array::functional::*;
/// Example function using generics to pass N-length sequences and map them
pub fn generic_map<S>(s: S)
where
S: FunctionalSequence<i32>, // `.map`
S::Item: Add<i32, Output = i32>, // `x + 1`
S: MappedGenericSequence<i32, i32>, // `i32` -> `i32`
MappedSequence<S, i32, i32>: Debug, // println!
{
let a = s.map(|x| x + 1);
println!("{:?}", a);
}
/// Complex example function using generics to pass N-length sequences, zip them, and then map that result.
///
/// If used with `GenericArray` specifically this isn't necessary
pub fn generic_sequence_zip_sum<A, B>(a: A, b: B) -> i32
where
A: FunctionalSequence<i32>, // `.zip`
B: FunctionalSequence<i32, Length = A::Length>, // `.zip`
A: MappedGenericSequence<i32, i32>, // `i32` -> `i32`
B: MappedGenericSequence<i32, i32, Mapped = MappedSequence<A, i32, i32>>, // `i32` -> `i32`, prove A and B can map to the same output
A::Item: Add<B::Item, Output = i32>, // `l + r`
MappedSequence<A, i32, i32>: MappedGenericSequence<i32, i32> + FunctionalSequence<i32>, // `.map`
SequenceItem<MappedSequence<A, i32, i32>>: Add<i32, Output=i32>, // `x + 1`
MappedSequence<MappedSequence<A, i32, i32>, i32, i32>: Debug, // `println!`
MappedSequence<MappedSequence<A, i32, i32>, i32, i32>: FunctionalSequence<i32>, // `.fold`
SequenceItem<MappedSequence<MappedSequence<A, i32, i32>, i32, i32>>: Add<i32, Output=i32> // `x + a`, note the order
{
let c = a.zip(b, |l, r| l + r).map(|x| x + 1);
println!("{:?}", c);
c.fold(0, |a, x| x + a)
}
/// Super-simple fixed-length i32 `GenericArray`s
pub fn generic_array_plain_zip_sum(a: GenericArray<i32, U4>, b: GenericArray<i32, U4>) -> i32 {
a.zip(b, |l, r| l + r).map(|x| x + 1).fold(0, |a, x| x + a)
}
pub fn generic_array_variable_length_zip_sum<N>(a: GenericArray<i32, N>, b: GenericArray<i32, N>) -> i32
where
N: ArrayLength<i32>,
{
a.zip(b, |l, r| l + r).map(|x| x + 1).fold(0, |a, x| x + a)
}
pub fn generic_array_same_type_variable_length_zip_sum<T, N>(a: GenericArray<T, N>, b: GenericArray<T, N>) -> i32
where
N: ArrayLength<T> + ArrayLength<<T as Add<T>>::Output>,
T: Add<T, Output=i32>,
{
a.zip(b, |l, r| l + r).map(|x| x + 1).fold(0, |a, x| x + a)
}
/// Complex example using fully generic `GenericArray`s with the same length.
///
/// It's mostly just the repeated `Add` traits, which would be present in other systems anyway.
pub fn generic_array_zip_sum<A, B, N: ArrayLength<A> + ArrayLength<B>>(a: GenericArray<A, N>, b: GenericArray<B, N>) -> i32
where
A: Add<B>,
N: ArrayLength<<A as Add<B>>::Output> +
ArrayLength<<<A as Add<B>>::Output as Add<i32>>::Output>,
<A as Add<B>>::Output: Add<i32>,
<<A as Add<B>>::Output as Add<i32>>::Output: Add<i32, Output=i32>,
{
a.zip(b, |l, r| l + r).map(|x| x + 1).fold(0, |a, x| x + a)
}
#[test]
fn test_generics() {
generic_map(arr![i32; 1, 2, 3, 4]);
assert_eq!(generic_sequence_zip_sum(arr![i32; 1, 2, 3, 4], arr![i32; 2, 3, 4, 5]), 28);
assert_eq!(generic_array_plain_zip_sum(arr![i32; 1, 2, 3, 4], arr![i32; 2, 3, 4, 5]), 28);
assert_eq!(generic_array_variable_length_zip_sum(arr![i32; 1, 2, 3, 4], arr![i32; 2, 3, 4, 5]), 28);
assert_eq!(generic_array_same_type_variable_length_zip_sum(arr![i32; 1, 2, 3, 4], arr![i32; 2, 3, 4, 5]), 28);
assert_eq!(generic_array_zip_sum(arr![i32; 1, 2, 3, 4], arr![i32; 2, 3, 4, 5]), 28);
#![recursion_limit = "128"]
#[macro_use]
extern crate generic_array;
use generic_array::typenum::consts::U4;
use std::fmt::Debug;
use std::ops::Add;
use generic_array::{GenericArray, ArrayLength};
use generic_array::sequence::*;
use generic_array::functional::*;
/// Example function using generics to pass N-length sequences and map them
pub fn generic_map<S>(s: S)
where
S: FunctionalSequence<i32>, // `.map`
S::Item: Add<i32, Output = i32>, // `x + 1`
S: MappedGenericSequence<i32, i32>, // `i32` -> `i32`
MappedSequence<S, i32, i32>: Debug, // println!
{
let a = s.map(|x| x + 1);
println!("{:?}", a);
}
/// Complex example function using generics to pass N-length sequences, zip them, and then map that result.
///
/// If used with `GenericArray` specifically this isn't necessary
pub fn generic_sequence_zip_sum<A, B>(a: A, b: B) -> i32
where
A: FunctionalSequence<i32>, // `.zip`
B: FunctionalSequence<i32, Length = A::Length>, // `.zip`
A: MappedGenericSequence<i32, i32>, // `i32` -> `i32`
B: MappedGenericSequence<i32, i32, Mapped = MappedSequence<A, i32, i32>>, // `i32` -> `i32`, prove A and B can map to the same output
A::Item: Add<B::Item, Output = i32>, // `l + r`
MappedSequence<A, i32, i32>: MappedGenericSequence<i32, i32> + FunctionalSequence<i32>, // `.map`
SequenceItem<MappedSequence<A, i32, i32>>: Add<i32, Output=i32>, // `x + 1`
MappedSequence<MappedSequence<A, i32, i32>, i32, i32>: Debug, // `println!`
MappedSequence<MappedSequence<A, i32, i32>, i32, i32>: FunctionalSequence<i32>, // `.fold`
SequenceItem<MappedSequence<MappedSequence<A, i32, i32>, i32, i32>>: Add<i32, Output=i32> // `x + a`, note the order
{
let c = a.zip(b, |l, r| l + r).map(|x| x + 1);
println!("{:?}", c);
c.fold(0, |a, x| x + a)
}
/// Super-simple fixed-length i32 `GenericArray`s
pub fn generic_array_plain_zip_sum(a: GenericArray<i32, U4>, b: GenericArray<i32, U4>) -> i32 {
a.zip(b, |l, r| l + r).map(|x| x + 1).fold(0, |a, x| x + a)
}
pub fn generic_array_variable_length_zip_sum<N>(a: GenericArray<i32, N>, b: GenericArray<i32, N>) -> i32
where
N: ArrayLength<i32>,
{
a.zip(b, |l, r| l + r).map(|x| x + 1).fold(0, |a, x| x + a)
}
pub fn generic_array_same_type_variable_length_zip_sum<T, N>(a: GenericArray<T, N>, b: GenericArray<T, N>) -> i32
where
N: ArrayLength<T> + ArrayLength<<T as Add<T>>::Output>,
T: Add<T, Output=i32>,
{
a.zip(b, |l, r| l + r).map(|x| x + 1).fold(0, |a, x| x + a)
}
/// Complex example using fully generic `GenericArray`s with the same length.
///
/// It's mostly just the repeated `Add` traits, which would be present in other systems anyway.
pub fn generic_array_zip_sum<A, B, N: ArrayLength<A> + ArrayLength<B>>(a: GenericArray<A, N>, b: GenericArray<B, N>) -> i32
where
A: Add<B>,
N: ArrayLength<<A as Add<B>>::Output> +
ArrayLength<<<A as Add<B>>::Output as Add<i32>>::Output>,
<A as Add<B>>::Output: Add<i32>,
<<A as Add<B>>::Output as Add<i32>>::Output: Add<i32, Output=i32>,
{
a.zip(b, |l, r| l + r).map(|x| x + 1).fold(0, |a, x| x + a)
}
#[test]
fn test_generics() {
generic_map(arr![i32; 1, 2, 3, 4]);
assert_eq!(generic_sequence_zip_sum(arr![i32; 1, 2, 3, 4], arr![i32; 2, 3, 4, 5]), 28);
assert_eq!(generic_array_plain_zip_sum(arr![i32; 1, 2, 3, 4], arr![i32; 2, 3, 4, 5]), 28);
assert_eq!(generic_array_variable_length_zip_sum(arr![i32; 1, 2, 3, 4], arr![i32; 2, 3, 4, 5]), 28);
assert_eq!(generic_array_same_type_variable_length_zip_sum(arr![i32; 1, 2, 3, 4], arr![i32; 2, 3, 4, 5]), 28);
assert_eq!(generic_array_zip_sum(arr![i32; 1, 2, 3, 4], arr![i32; 2, 3, 4, 5]), 28);
}

View File

@ -1,61 +1,61 @@
#[macro_use]
extern crate generic_array;
extern crate typenum;
use generic_array::GenericArray;
use std::str::from_utf8;
use typenum::U2048;
#[test]
fn short_lower_hex() {
let ar = arr![u8; 10, 20, 30];
assert_eq!(format!("{:x}", ar), "0a141e");
}
#[test]
fn short_upper_hex() {
let ar = arr![u8; 30, 20, 10];
assert_eq!(format!("{:X}", ar), "1E140A");
}
#[test]
fn long_lower_hex() {
let ar = GenericArray::<u8, U2048>::default();
assert_eq!(format!("{:x}", ar), from_utf8(&[b'0'; 4096]).unwrap());
}
#[test]
fn long_lower_hex_truncated() {
let ar = GenericArray::<u8, U2048>::default();
assert_eq!(format!("{:.3001x}", ar), from_utf8(&[b'0'; 3001]).unwrap());
}
#[test]
fn long_upper_hex() {
let ar = GenericArray::<u8, U2048>::default();
assert_eq!(format!("{:X}", ar), from_utf8(&[b'0'; 4096]).unwrap());
}
#[test]
fn long_upper_hex_truncated() {
let ar = GenericArray::<u8, U2048>::default();
assert_eq!(format!("{:.2777X}", ar), from_utf8(&[b'0'; 2777]).unwrap());
}
#[test]
fn truncated_lower_hex() {
let ar = arr![u8; 10, 20, 30, 40, 50];
assert_eq!(format!("{:.2x}", ar), "0a");
assert_eq!(format!("{:.3x}", ar), "0a1");
assert_eq!(format!("{:.4x}", ar), "0a14");
}
#[test]
fn truncated_upper_hex() {
let ar = arr![u8; 30, 20, 10, 17, 0];
assert_eq!(format!("{:.4X}", ar), "1E14");
assert_eq!(format!("{:.5X}", ar), "1E140");
assert_eq!(format!("{:.6X}", ar), "1E140A");
assert_eq!(format!("{:.7X}", ar), "1E140A1");
assert_eq!(format!("{:.8X}", ar), "1E140A11");
}
#[macro_use]
extern crate generic_array;
extern crate typenum;
use generic_array::GenericArray;
use std::str::from_utf8;
use typenum::U2048;
#[test]
fn short_lower_hex() {
let ar = arr![u8; 10, 20, 30];
assert_eq!(format!("{:x}", ar), "0a141e");
}
#[test]
fn short_upper_hex() {
let ar = arr![u8; 30, 20, 10];
assert_eq!(format!("{:X}", ar), "1E140A");
}
#[test]
fn long_lower_hex() {
let ar = GenericArray::<u8, U2048>::default();
assert_eq!(format!("{:x}", ar), from_utf8(&[b'0'; 4096]).unwrap());
}
#[test]
fn long_lower_hex_truncated() {
let ar = GenericArray::<u8, U2048>::default();
assert_eq!(format!("{:.3001x}", ar), from_utf8(&[b'0'; 3001]).unwrap());
}
#[test]
fn long_upper_hex() {
let ar = GenericArray::<u8, U2048>::default();
assert_eq!(format!("{:X}", ar), from_utf8(&[b'0'; 4096]).unwrap());
}
#[test]
fn long_upper_hex_truncated() {
let ar = GenericArray::<u8, U2048>::default();
assert_eq!(format!("{:.2777X}", ar), from_utf8(&[b'0'; 2777]).unwrap());
}
#[test]
fn truncated_lower_hex() {
let ar = arr![u8; 10, 20, 30, 40, 50];
assert_eq!(format!("{:.2x}", ar), "0a");
assert_eq!(format!("{:.3x}", ar), "0a1");
assert_eq!(format!("{:.4x}", ar), "0a14");
}
#[test]
fn truncated_upper_hex() {
let ar = arr![u8; 30, 20, 10, 17, 0];
assert_eq!(format!("{:.4X}", ar), "1E14");
assert_eq!(format!("{:.5X}", ar), "1E140");
assert_eq!(format!("{:.6X}", ar), "1E140A");
assert_eq!(format!("{:.7X}", ar), "1E140A1");
assert_eq!(format!("{:.8X}", ar), "1E140A11");
}

View File

@ -1,10 +1,10 @@
#[macro_use]
extern crate generic_array as gen_arr;
use gen_arr::typenum;
#[test]
fn test_different_crate_name() {
let _: gen_arr::GenericArray<u32, typenum::U4> = arr![u32; 0, 1, 2, 3];
let _: gen_arr::GenericArray<u32, typenum::U0> = arr![u32;];
}
#[macro_use]
extern crate generic_array as gen_arr;
use gen_arr::typenum;
#[test]
fn test_different_crate_name() {
let _: gen_arr::GenericArray<u32, typenum::U4> = arr![u32; 0, 1, 2, 3];
let _: gen_arr::GenericArray<u32, typenum::U0> = arr![u32;];
}

View File

@ -1,199 +1,199 @@
#[macro_use]
extern crate generic_array;
use std::cell::Cell;
use std::ops::Drop;
use generic_array::typenum::consts::U5;
use generic_array::GenericArray;
#[test]
fn test_from_iterator() {
struct BadExact(usize);
impl Iterator for BadExact {
type Item = usize;
fn next(&mut self) -> Option<usize> {
if self.0 == 1 {
return None;
}
self.0 -= 1;
Some(self.0)
}
}
impl ExactSizeIterator for BadExact {
fn len(&self) -> usize { self.0 }
}
assert!(GenericArray::<usize, U5>::from_exact_iter(BadExact(5)).is_none());
}
#[test]
fn test_into_iter_as_slice() {
let array = arr![char; 'a', 'b', 'c'];
let mut into_iter = array.into_iter();
assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
let _ = into_iter.next().unwrap();
assert_eq!(into_iter.as_slice(), &['b', 'c']);
let _ = into_iter.next().unwrap();
let _ = into_iter.next().unwrap();
assert_eq!(into_iter.as_slice(), &[]);
}
#[test]
fn test_into_iter_as_mut_slice() {
let array = arr![char; 'a', 'b', 'c'];
let mut into_iter = array.into_iter();
assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
into_iter.as_mut_slice()[0] = 'x';
into_iter.as_mut_slice()[1] = 'y';
assert_eq!(into_iter.next().unwrap(), 'x');
assert_eq!(into_iter.as_slice(), &['y', 'c']);
}
#[test]
fn test_into_iter_debug() {
let array = arr![char; 'a', 'b', 'c'];
let into_iter = array.into_iter();
let debug = format!("{:?}", into_iter);
assert_eq!(debug, "GenericArrayIter(['a', 'b', 'c'])");
}
#[test]
fn test_into_iter_clone() {
fn iter_equal<I: Iterator<Item = i32>>(it: I, slice: &[i32]) {
let v: Vec<i32> = it.collect();
assert_eq!(&v[..], slice);
}
let mut it = arr![i32; 1, 2, 3].into_iter();
iter_equal(it.clone(), &[1, 2, 3]);
assert_eq!(it.next(), Some(1));
let mut it = it.rev();
iter_equal(it.clone(), &[3, 2]);
assert_eq!(it.next(), Some(3));
iter_equal(it.clone(), &[2]);
assert_eq!(it.next(), Some(2));
iter_equal(it.clone(), &[]);
assert_eq!(it.next(), None);
}
#[test]
fn test_into_iter_nth() {
let v = arr![i32; 0, 1, 2, 3, 4];
for i in 0..v.len() {
assert_eq!(v.clone().into_iter().nth(i).unwrap(), v[i]);
}
assert_eq!(v.clone().into_iter().nth(v.len()), None);
let mut iter = v.into_iter();
assert_eq!(iter.nth(2).unwrap(), v[2]);
assert_eq!(iter.nth(1).unwrap(), v[4]);
}
#[test]
fn test_into_iter_last() {
let v = arr![i32; 0, 1, 2, 3, 4];
assert_eq!(v.into_iter().last().unwrap(), 4);
assert_eq!(arr![i32; 0].into_iter().last().unwrap(), 0);
}
#[test]
fn test_into_iter_count() {
let v = arr![i32; 0, 1, 2, 3, 4];
assert_eq!(v.clone().into_iter().count(), 5);
let mut iter2 = v.into_iter();
iter2.next();
iter2.next();
assert_eq!(iter2.count(), 3);
}
#[test]
fn test_into_iter_flat_map() {
assert!((0..5).flat_map(|i| arr![i32; 2 * i, 2 * i + 1]).eq(0..10));
}
#[test]
fn test_into_iter_fold() {
assert_eq!(
arr![i32; 1, 2, 3, 4].into_iter().fold(0, |sum, x| sum + x),
10
);
let mut iter = arr![i32; 0, 1, 2, 3, 4, 5].into_iter();
iter.next();
iter.next_back();
assert_eq!(iter.clone().fold(0, |sum, x| sum + x), 10);
assert_eq!(iter.rfold(0, |sum, x| sum + x), 10);
}
#[test]
fn test_into_iter_drops() {
struct R<'a> {
i: &'a Cell<usize>,
}
impl<'a> Drop for R<'a> {
fn drop(&mut self) {
self.i.set(self.i.get() + 1);
}
}
fn r(i: &Cell<usize>) -> R {
R { i: i }
}
fn v(i: &Cell<usize>) -> GenericArray<R, U5> {
arr![R; r(i), r(i), r(i), r(i), r(i)]
}
let i = Cell::new(0);
{
v(&i).into_iter();
}
assert_eq!(i.get(), 5);
let i = Cell::new(0);
{
let mut iter = v(&i).into_iter();
let _x = iter.next();
assert_eq!(i.get(), 0);
assert_eq!(iter.count(), 4);
assert_eq!(i.get(), 4);
}
assert_eq!(i.get(), 5);
let i = Cell::new(0);
{
let mut iter = v(&i).into_iter();
let _x = iter.nth(2);
assert_eq!(i.get(), 2);
let _y = iter.last();
assert_eq!(i.get(), 3);
}
assert_eq!(i.get(), 5);
let i = Cell::new(0);
for (index, _x) in v(&i).into_iter().enumerate() {
assert_eq!(i.get(), index);
}
assert_eq!(i.get(), 5);
let i = Cell::new(0);
for (index, _x) in v(&i).into_iter().rev().enumerate() {
assert_eq!(i.get(), index);
}
assert_eq!(i.get(), 5);
}
/*
//TODO: Cover this
#[allow(dead_code)]
fn assert_covariance() {
fn into_iter<'new>(i: GenericArrayIter<&'static str, U10>) -> GenericArrayIter<&'new str, U10> {
i
}
}
*/
#[macro_use]
extern crate generic_array;
use std::cell::Cell;
use std::ops::Drop;
use generic_array::typenum::consts::U5;
use generic_array::GenericArray;
#[test]
fn test_from_iterator() {
struct BadExact(usize);
impl Iterator for BadExact {
type Item = usize;
fn next(&mut self) -> Option<usize> {
if self.0 == 1 {
return None;
}
self.0 -= 1;
Some(self.0)
}
}
impl ExactSizeIterator for BadExact {
fn len(&self) -> usize { self.0 }
}
assert!(GenericArray::<usize, U5>::from_exact_iter(BadExact(5)).is_none());
}
#[test]
fn test_into_iter_as_slice() {
let array = arr![char; 'a', 'b', 'c'];
let mut into_iter = array.into_iter();
assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
let _ = into_iter.next().unwrap();
assert_eq!(into_iter.as_slice(), &['b', 'c']);
let _ = into_iter.next().unwrap();
let _ = into_iter.next().unwrap();
assert_eq!(into_iter.as_slice(), &[]);
}
#[test]
fn test_into_iter_as_mut_slice() {
let array = arr![char; 'a', 'b', 'c'];
let mut into_iter = array.into_iter();
assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
into_iter.as_mut_slice()[0] = 'x';
into_iter.as_mut_slice()[1] = 'y';
assert_eq!(into_iter.next().unwrap(), 'x');
assert_eq!(into_iter.as_slice(), &['y', 'c']);
}
#[test]
fn test_into_iter_debug() {
let array = arr![char; 'a', 'b', 'c'];
let into_iter = array.into_iter();
let debug = format!("{:?}", into_iter);
assert_eq!(debug, "GenericArrayIter(['a', 'b', 'c'])");
}
#[test]
fn test_into_iter_clone() {
fn iter_equal<I: Iterator<Item = i32>>(it: I, slice: &[i32]) {
let v: Vec<i32> = it.collect();
assert_eq!(&v[..], slice);
}
let mut it = arr![i32; 1, 2, 3].into_iter();
iter_equal(it.clone(), &[1, 2, 3]);
assert_eq!(it.next(), Some(1));
let mut it = it.rev();
iter_equal(it.clone(), &[3, 2]);
assert_eq!(it.next(), Some(3));
iter_equal(it.clone(), &[2]);
assert_eq!(it.next(), Some(2));
iter_equal(it.clone(), &[]);
assert_eq!(it.next(), None);
}
#[test]
fn test_into_iter_nth() {
let v = arr![i32; 0, 1, 2, 3, 4];
for i in 0..v.len() {
assert_eq!(v.clone().into_iter().nth(i).unwrap(), v[i]);
}
assert_eq!(v.clone().into_iter().nth(v.len()), None);
let mut iter = v.into_iter();
assert_eq!(iter.nth(2).unwrap(), v[2]);
assert_eq!(iter.nth(1).unwrap(), v[4]);
}
#[test]
fn test_into_iter_last() {
let v = arr![i32; 0, 1, 2, 3, 4];
assert_eq!(v.into_iter().last().unwrap(), 4);
assert_eq!(arr![i32; 0].into_iter().last().unwrap(), 0);
}
#[test]
fn test_into_iter_count() {
let v = arr![i32; 0, 1, 2, 3, 4];
assert_eq!(v.clone().into_iter().count(), 5);
let mut iter2 = v.into_iter();
iter2.next();
iter2.next();
assert_eq!(iter2.count(), 3);
}
#[test]
fn test_into_iter_flat_map() {
assert!((0..5).flat_map(|i| arr![i32; 2 * i, 2 * i + 1]).eq(0..10));
}
#[test]
fn test_into_iter_fold() {
assert_eq!(
arr![i32; 1, 2, 3, 4].into_iter().fold(0, |sum, x| sum + x),
10
);
let mut iter = arr![i32; 0, 1, 2, 3, 4, 5].into_iter();
iter.next();
iter.next_back();
assert_eq!(iter.clone().fold(0, |sum, x| sum + x), 10);
assert_eq!(iter.rfold(0, |sum, x| sum + x), 10);
}
#[test]
fn test_into_iter_drops() {
struct R<'a> {
i: &'a Cell<usize>,
}
impl<'a> Drop for R<'a> {
fn drop(&mut self) {
self.i.set(self.i.get() + 1);
}
}
fn r(i: &Cell<usize>) -> R {
R { i: i }
}
fn v(i: &Cell<usize>) -> GenericArray<R, U5> {
arr![R; r(i), r(i), r(i), r(i), r(i)]
}
let i = Cell::new(0);
{
v(&i).into_iter();
}
assert_eq!(i.get(), 5);
let i = Cell::new(0);
{
let mut iter = v(&i).into_iter();
let _x = iter.next();
assert_eq!(i.get(), 0);
assert_eq!(iter.count(), 4);
assert_eq!(i.get(), 4);
}
assert_eq!(i.get(), 5);
let i = Cell::new(0);
{
let mut iter = v(&i).into_iter();
let _x = iter.nth(2);
assert_eq!(i.get(), 2);
let _y = iter.last();
assert_eq!(i.get(), 3);
}
assert_eq!(i.get(), 5);
let i = Cell::new(0);
for (index, _x) in v(&i).into_iter().enumerate() {
assert_eq!(i.get(), index);
}
assert_eq!(i.get(), 5);
let i = Cell::new(0);
for (index, _x) in v(&i).into_iter().rev().enumerate() {
assert_eq!(i.get(), index);
}
assert_eq!(i.get(), 5);
}
/*
//TODO: Cover this
#[allow(dead_code)]
fn assert_covariance() {
fn into_iter<'new>(i: GenericArrayIter<&'static str, U10>) -> GenericArrayIter<&'new str, U10> {
i
}
}
*/

View File

@ -1,379 +1,379 @@
#![recursion_limit = "128"]
#![no_std]
#[macro_use]
extern crate generic_array;
use core::cell::Cell;
use core::ops::{Add, Drop};
use generic_array::functional::*;
use generic_array::sequence::*;
use generic_array::typenum::{U0, U3, U4, U97};
use generic_array::GenericArray;
#[test]
fn test() {
let mut list97 = [0; 97];
for i in 0..97 {
list97[i] = i as i32;
}
let l: GenericArray<i32, U97> = GenericArray::clone_from_slice(&list97);
assert_eq!(l[0], 0);
assert_eq!(l[1], 1);
assert_eq!(l[32], 32);
assert_eq!(l[56], 56);
}
#[test]
fn test_drop() {
#[derive(Clone)]
struct TestDrop<'a>(&'a Cell<u32>);
impl<'a> Drop for TestDrop<'a> {
fn drop(&mut self) {
self.0.set(self.0.get() + 1);
}
}
let drop_counter = Cell::new(0);
{
let _: GenericArray<TestDrop, U3> = arr![TestDrop; TestDrop(&drop_counter),
TestDrop(&drop_counter),
TestDrop(&drop_counter)];
}
assert_eq!(drop_counter.get(), 3);
}
#[test]
fn test_arr() {
let test: GenericArray<u32, U3> = arr![u32; 1, 2, 3];
assert_eq!(test[1], 2);
}
#[test]
fn test_copy() {
let test = arr![u32; 1, 2, 3];
let test2 = test;
// if GenericArray is not copy, this should fail as a use of a moved value
assert_eq!(test[1], 2);
assert_eq!(test2[0], 1);
}
#[derive(Debug, PartialEq, Eq)]
struct NoClone<T>(T);
#[test]
fn test_from_slice() {
let arr = [1, 2, 3, 4];
let gen_arr = GenericArray::<_, U3>::from_slice(&arr[..3]);
assert_eq!(&arr[..3], gen_arr.as_slice());
let arr = [NoClone(1u32), NoClone(2), NoClone(3), NoClone(4)];
let gen_arr = GenericArray::<_, U3>::from_slice(&arr[..3]);
assert_eq!(&arr[..3], gen_arr.as_slice());
}
#[test]
fn test_from_mut_slice() {
let mut arr = [1, 2, 3, 4];
{
let gen_arr = GenericArray::<_, U3>::from_mut_slice(&mut arr[..3]);
gen_arr[2] = 10;
}
assert_eq!(arr, [1, 2, 10, 4]);
let mut arr = [NoClone(1u32), NoClone(2), NoClone(3), NoClone(4)];
{
let gen_arr = GenericArray::<_, U3>::from_mut_slice(&mut arr[..3]);
gen_arr[2] = NoClone(10);
}
assert_eq!(arr, [NoClone(1), NoClone(2), NoClone(10), NoClone(4)]);
}
#[test]
fn test_default() {
let arr = GenericArray::<u8, U4>::default();
assert_eq!(arr.as_slice(), &[0, 0, 0, 0]);
}
#[test]
fn test_from() {
let data = [(1, 2, 3), (4, 5, 6), (7, 8, 9)];
let garray: GenericArray<(usize, usize, usize), U3> = data.into();
assert_eq!(&data, garray.as_slice());
}
#[test]
fn test_unit_macro() {
let arr = arr![f32; 3.14];
assert_eq!(arr[0], 3.14);
}
#[test]
fn test_empty_macro() {
let _arr = arr![f32;];
}
#[test]
fn test_cmp() {
let _ = arr![u8; 0x00].cmp(&arr![u8; 0x00]);
}
/// This test should cause a helpful compile error if uncommented.
// #[test]
// fn test_empty_macro2(){
// let arr = arr![];
// }
#[cfg(feature = "serde")]
mod impl_serde {
extern crate serde_json;
use generic_array::typenum::U6;
use generic_array::GenericArray;
#[test]
fn test_serde_implementation() {
let array: GenericArray<f64, U6> = arr![f64; 0.0, 5.0, 3.0, 7.07192, 76.0, -9.0];
let string = serde_json::to_string(&array).unwrap();
assert_eq!(string, "[0.0,5.0,3.0,7.07192,76.0,-9.0]");
let test_array: GenericArray<f64, U6> = serde_json::from_str(&string).unwrap();
assert_eq!(test_array, array);
}
}
#[test]
fn test_map() {
let b: GenericArray<i32, U4> = GenericArray::generate(|i| i as i32 * 4).map(|x| x - 3);
assert_eq!(b, arr![i32; -3, 1, 5, 9]);
}
#[test]
fn test_zip() {
let a: GenericArray<_, U4> = GenericArray::generate(|i| i + 1);
let b: GenericArray<_, U4> = GenericArray::generate(|i| i as i32 * 4);
// Uses reference and non-reference arguments
let c = (&a).zip(b, |r, l| *r as i32 + l);
assert_eq!(c, arr![i32; 1, 6, 11, 16]);
}
#[test]
#[should_panic]
fn test_from_iter_short() {
use core::iter::repeat;
let a: GenericArray<_, U4> = repeat(11).take(3).collect();
assert_eq!(a, arr![i32; 11, 11, 11, 0]);
}
#[test]
fn test_from_iter() {
use core::iter::{once, repeat};
let a: GenericArray<_, U4> = repeat(11).take(3).chain(once(0)).collect();
assert_eq!(a, arr![i32; 11, 11, 11, 0]);
}
#[allow(unused)]
#[derive(Debug, Copy, Clone)]
enum E {
V,
V2(i32),
V3 { h: bool, i: i32 },
}
#[allow(unused)]
#[derive(Debug, Copy, Clone)]
#[repr(C)]
#[repr(packed)]
struct Test {
t: u16,
s: u32,
mm: bool,
r: u16,
f: u16,
p: (),
o: u32,
ff: *const extern "C" fn(*const char) -> *const core::ffi::c_void,
l: *const core::ffi::c_void,
w: bool,
q: bool,
v: E,
}
#[test]
fn test_sizes() {
use core::mem::{size_of, size_of_val};
assert_eq!(size_of::<E>(), 8);
assert_eq!(size_of::<Test>(), 25 + size_of::<usize>() * 2);
assert_eq!(size_of_val(&arr![u8; 1, 2, 3]), size_of::<u8>() * 3);
assert_eq!(size_of_val(&arr![u32; 1]), size_of::<u32>() * 1);
assert_eq!(size_of_val(&arr![u64; 1, 2, 3, 4]), size_of::<u64>() * 4);
assert_eq!(size_of::<GenericArray<Test, U97>>(), size_of::<Test>() * 97);
}
#[test]
fn test_alignment() {
use core::mem::align_of;
assert_eq!(align_of::<GenericArray::<u32, U0>>(), align_of::<[u32; 0]>());
assert_eq!(align_of::<GenericArray::<u32, U3>>(), align_of::<[u32; 3]>());
assert_eq!(align_of::<GenericArray::<Test, U3>>(), align_of::<[Test; 3]>());
}
#[test]
fn test_append() {
let a = arr![i32; 1, 2, 3];
let b = a.append(4);
assert_eq!(b, arr![i32; 1, 2, 3, 4]);
}
#[test]
fn test_prepend() {
let a = arr![i32; 1, 2, 3];
let b = a.prepend(4);
assert_eq!(b, arr![i32; 4, 1, 2, 3]);
}
#[test]
fn test_pop() {
let a = arr![i32; 1, 2, 3, 4];
let (init, last) = a.pop_back();
assert_eq!(init, arr![i32; 1, 2, 3]);
assert_eq!(last, 4);
let (head, tail) = a.pop_front();
assert_eq!(head, 1);
assert_eq!(tail, arr![i32; 2, 3, 4]);
}
#[test]
fn test_split() {
let a = arr![i32; 1, 2, 3, 4];
let (b, c) = a.split();
assert_eq!(b, arr![i32; 1]);
assert_eq!(c, arr![i32; 2, 3, 4]);
let (e, f) = a.split();
assert_eq!(e, arr![i32; 1, 2]);
assert_eq!(f, arr![i32; 3, 4]);
}
#[test]
fn test_split_ref() {
let a = arr![i32; 1, 2, 3, 4];
let a_ref = &a;
let (b_ref, c_ref) = a_ref.split();
assert_eq!(b_ref, &arr![i32; 1]);
assert_eq!(c_ref, &arr![i32; 2, 3, 4]);
let (e_ref, f_ref) = a_ref.split();
assert_eq!(e_ref, &arr![i32; 1, 2]);
assert_eq!(f_ref, &arr![i32; 3, 4]);
}
#[test]
fn test_split_mut() {
let mut a = arr![i32; 1, 2, 3, 4];
let a_ref = &mut a;
let (b_ref, c_ref) = a_ref.split();
assert_eq!(b_ref, &mut arr![i32; 1]);
assert_eq!(c_ref, &mut arr![i32; 2, 3, 4]);
let (e_ref, f_ref) = a_ref.split();
assert_eq!(e_ref, &mut arr![i32; 1, 2]);
assert_eq!(f_ref, &mut arr![i32; 3, 4]);
}
#[test]
fn test_concat() {
let a = arr![i32; 1, 2];
let b = arr![i32; 3, 4, 5];
let c = a.concat(b);
assert_eq!(c, arr![i32; 1, 2, 3, 4, 5]);
let (d, e) = c.split();
assert_eq!(d, arr![i32; 1, 2]);
assert_eq!(e, arr![i32; 3, 4, 5]);
}
#[test]
fn test_fold() {
let a = arr![i32; 1, 2, 3, 4];
assert_eq!(10, a.fold(0, |a, x| a + x));
}
fn sum_generic<S>(s: S) -> i32
where
S: FunctionalSequence<i32>,
S::Item: Add<i32, Output = i32>, // `+`
i32: Add<S::Item, Output = i32>, // reflexive
{
s.fold(0, |a, x| a + x)
}
#[test]
fn test_sum() {
let a = sum_generic(arr![i32; 1, 2, 3, 4]);
assert_eq!(a, 10);
}
#[test]
fn test_as_ref() {
let a = arr![i32; 1, 2, 3, 4];
let a_ref: &[i32; 4] = a.as_ref();
assert_eq!(a_ref, &[1, 2, 3, 4]);
}
#[test]
fn test_as_mut() {
let mut a = arr![i32; 1, 2, 3, 4];
let a_mut: &mut [i32; 4] = a.as_mut();
assert_eq!(a_mut, &mut [1, 2, 3, 4]);
a_mut[2] = 0;
assert_eq!(a_mut, &mut [1, 2, 0, 4]);
assert_eq!(a, arr![i32; 1, 2, 0, 4]);
}
#[test]
fn test_from_array_ref() {
let a = arr![i32; 1, 2, 3, 4];
let a_ref: &[i32; 4] = a.as_ref();
let a_from: &GenericArray<i32, U4> = a_ref.into();
assert_eq!(&a, a_from);
}
#[test]
fn test_from_array_mut() {
let mut a = arr![i32; 1, 2, 3, 4];
let mut a_copy = a;
let a_mut: &mut [i32; 4] = a.as_mut();
let a_from: &mut GenericArray<i32, U4> = a_mut.into();
assert_eq!(&mut a_copy, a_from);
}
#![recursion_limit = "128"]
#![no_std]
#[macro_use]
extern crate generic_array;
use core::cell::Cell;
use core::ops::{Add, Drop};
use generic_array::functional::*;
use generic_array::sequence::*;
use generic_array::typenum::{U0, U3, U4, U97};
use generic_array::GenericArray;
#[test]
fn test() {
let mut list97 = [0; 97];
for i in 0..97 {
list97[i] = i as i32;
}
let l: GenericArray<i32, U97> = GenericArray::clone_from_slice(&list97);
assert_eq!(l[0], 0);
assert_eq!(l[1], 1);
assert_eq!(l[32], 32);
assert_eq!(l[56], 56);
}
#[test]
fn test_drop() {
#[derive(Clone)]
struct TestDrop<'a>(&'a Cell<u32>);
impl<'a> Drop for TestDrop<'a> {
fn drop(&mut self) {
self.0.set(self.0.get() + 1);
}
}
let drop_counter = Cell::new(0);
{
let _: GenericArray<TestDrop, U3> = arr![TestDrop; TestDrop(&drop_counter),
TestDrop(&drop_counter),
TestDrop(&drop_counter)];
}
assert_eq!(drop_counter.get(), 3);
}
#[test]
fn test_arr() {
let test: GenericArray<u32, U3> = arr![u32; 1, 2, 3];
assert_eq!(test[1], 2);
}
#[test]
fn test_copy() {
let test = arr![u32; 1, 2, 3];
let test2 = test;
// if GenericArray is not copy, this should fail as a use of a moved value
assert_eq!(test[1], 2);
assert_eq!(test2[0], 1);
}
#[derive(Debug, PartialEq, Eq)]
struct NoClone<T>(T);
#[test]
fn test_from_slice() {
let arr = [1, 2, 3, 4];
let gen_arr = GenericArray::<_, U3>::from_slice(&arr[..3]);
assert_eq!(&arr[..3], gen_arr.as_slice());
let arr = [NoClone(1u32), NoClone(2), NoClone(3), NoClone(4)];
let gen_arr = GenericArray::<_, U3>::from_slice(&arr[..3]);
assert_eq!(&arr[..3], gen_arr.as_slice());
}
#[test]
fn test_from_mut_slice() {
let mut arr = [1, 2, 3, 4];
{
let gen_arr = GenericArray::<_, U3>::from_mut_slice(&mut arr[..3]);
gen_arr[2] = 10;
}
assert_eq!(arr, [1, 2, 10, 4]);
let mut arr = [NoClone(1u32), NoClone(2), NoClone(3), NoClone(4)];
{
let gen_arr = GenericArray::<_, U3>::from_mut_slice(&mut arr[..3]);
gen_arr[2] = NoClone(10);
}
assert_eq!(arr, [NoClone(1), NoClone(2), NoClone(10), NoClone(4)]);
}
#[test]
fn test_default() {
let arr = GenericArray::<u8, U4>::default();
assert_eq!(arr.as_slice(), &[0, 0, 0, 0]);
}
#[test]
fn test_from() {
let data = [(1, 2, 3), (4, 5, 6), (7, 8, 9)];
let garray: GenericArray<(usize, usize, usize), U3> = data.into();
assert_eq!(&data, garray.as_slice());
}
#[test]
fn test_unit_macro() {
let arr = arr![f32; 3.14];
assert_eq!(arr[0], 3.14);
}
#[test]
fn test_empty_macro() {
let _arr = arr![f32;];
}
#[test]
fn test_cmp() {
let _ = arr![u8; 0x00].cmp(&arr![u8; 0x00]);
}
/// This test should cause a helpful compile error if uncommented.
// #[test]
// fn test_empty_macro2(){
// let arr = arr![];
// }
#[cfg(feature = "serde")]
mod impl_serde {
extern crate serde_json;
use generic_array::typenum::U6;
use generic_array::GenericArray;
#[test]
fn test_serde_implementation() {
let array: GenericArray<f64, U6> = arr![f64; 0.0, 5.0, 3.0, 7.07192, 76.0, -9.0];
let string = serde_json::to_string(&array).unwrap();
assert_eq!(string, "[0.0,5.0,3.0,7.07192,76.0,-9.0]");
let test_array: GenericArray<f64, U6> = serde_json::from_str(&string).unwrap();
assert_eq!(test_array, array);
}
}
#[test]
fn test_map() {
let b: GenericArray<i32, U4> = GenericArray::generate(|i| i as i32 * 4).map(|x| x - 3);
assert_eq!(b, arr![i32; -3, 1, 5, 9]);
}
#[test]
fn test_zip() {
let a: GenericArray<_, U4> = GenericArray::generate(|i| i + 1);
let b: GenericArray<_, U4> = GenericArray::generate(|i| i as i32 * 4);
// Uses reference and non-reference arguments
let c = (&a).zip(b, |r, l| *r as i32 + l);
assert_eq!(c, arr![i32; 1, 6, 11, 16]);
}
#[test]
#[should_panic]
fn test_from_iter_short() {
use core::iter::repeat;
let a: GenericArray<_, U4> = repeat(11).take(3).collect();
assert_eq!(a, arr![i32; 11, 11, 11, 0]);
}
#[test]
fn test_from_iter() {
use core::iter::{once, repeat};
let a: GenericArray<_, U4> = repeat(11).take(3).chain(once(0)).collect();
assert_eq!(a, arr![i32; 11, 11, 11, 0]);
}
#[allow(unused)]
#[derive(Debug, Copy, Clone)]
enum E {
V,
V2(i32),
V3 { h: bool, i: i32 },
}
#[allow(unused)]
#[derive(Debug, Copy, Clone)]
#[repr(C)]
#[repr(packed)]
struct Test {
t: u16,
s: u32,
mm: bool,
r: u16,
f: u16,
p: (),
o: u32,
ff: *const extern "C" fn(*const char) -> *const core::ffi::c_void,
l: *const core::ffi::c_void,
w: bool,
q: bool,
v: E,
}
#[test]
fn test_sizes() {
use core::mem::{size_of, size_of_val};
assert_eq!(size_of::<E>(), 8);
assert_eq!(size_of::<Test>(), 25 + size_of::<usize>() * 2);
assert_eq!(size_of_val(&arr![u8; 1, 2, 3]), size_of::<u8>() * 3);
assert_eq!(size_of_val(&arr![u32; 1]), size_of::<u32>() * 1);
assert_eq!(size_of_val(&arr![u64; 1, 2, 3, 4]), size_of::<u64>() * 4);
assert_eq!(size_of::<GenericArray<Test, U97>>(), size_of::<Test>() * 97);
}
#[test]
fn test_alignment() {
use core::mem::align_of;
assert_eq!(align_of::<GenericArray::<u32, U0>>(), align_of::<[u32; 0]>());
assert_eq!(align_of::<GenericArray::<u32, U3>>(), align_of::<[u32; 3]>());
assert_eq!(align_of::<GenericArray::<Test, U3>>(), align_of::<[Test; 3]>());
}
#[test]
fn test_append() {
let a = arr![i32; 1, 2, 3];
let b = a.append(4);
assert_eq!(b, arr![i32; 1, 2, 3, 4]);
}
#[test]
fn test_prepend() {
let a = arr![i32; 1, 2, 3];
let b = a.prepend(4);
assert_eq!(b, arr![i32; 4, 1, 2, 3]);
}
#[test]
fn test_pop() {
let a = arr![i32; 1, 2, 3, 4];
let (init, last) = a.pop_back();
assert_eq!(init, arr![i32; 1, 2, 3]);
assert_eq!(last, 4);
let (head, tail) = a.pop_front();
assert_eq!(head, 1);
assert_eq!(tail, arr![i32; 2, 3, 4]);
}
#[test]
fn test_split() {
let a = arr![i32; 1, 2, 3, 4];
let (b, c) = a.split();
assert_eq!(b, arr![i32; 1]);
assert_eq!(c, arr![i32; 2, 3, 4]);
let (e, f) = a.split();
assert_eq!(e, arr![i32; 1, 2]);
assert_eq!(f, arr![i32; 3, 4]);
}
#[test]
fn test_split_ref() {
let a = arr![i32; 1, 2, 3, 4];
let a_ref = &a;
let (b_ref, c_ref) = a_ref.split();
assert_eq!(b_ref, &arr![i32; 1]);
assert_eq!(c_ref, &arr![i32; 2, 3, 4]);
let (e_ref, f_ref) = a_ref.split();
assert_eq!(e_ref, &arr![i32; 1, 2]);
assert_eq!(f_ref, &arr![i32; 3, 4]);
}
#[test]
fn test_split_mut() {
let mut a = arr![i32; 1, 2, 3, 4];
let a_ref = &mut a;
let (b_ref, c_ref) = a_ref.split();
assert_eq!(b_ref, &mut arr![i32; 1]);
assert_eq!(c_ref, &mut arr![i32; 2, 3, 4]);
let (e_ref, f_ref) = a_ref.split();
assert_eq!(e_ref, &mut arr![i32; 1, 2]);
assert_eq!(f_ref, &mut arr![i32; 3, 4]);
}
#[test]
fn test_concat() {
let a = arr![i32; 1, 2];
let b = arr![i32; 3, 4, 5];
let c = a.concat(b);
assert_eq!(c, arr![i32; 1, 2, 3, 4, 5]);
let (d, e) = c.split();
assert_eq!(d, arr![i32; 1, 2]);
assert_eq!(e, arr![i32; 3, 4, 5]);
}
#[test]
fn test_fold() {
let a = arr![i32; 1, 2, 3, 4];
assert_eq!(10, a.fold(0, |a, x| a + x));
}
fn sum_generic<S>(s: S) -> i32
where
S: FunctionalSequence<i32>,
S::Item: Add<i32, Output = i32>, // `+`
i32: Add<S::Item, Output = i32>, // reflexive
{
s.fold(0, |a, x| a + x)
}
#[test]
fn test_sum() {
let a = sum_generic(arr![i32; 1, 2, 3, 4]);
assert_eq!(a, 10);
}
#[test]
fn test_as_ref() {
let a = arr![i32; 1, 2, 3, 4];
let a_ref: &[i32; 4] = a.as_ref();
assert_eq!(a_ref, &[1, 2, 3, 4]);
}
#[test]
fn test_as_mut() {
let mut a = arr![i32; 1, 2, 3, 4];
let a_mut: &mut [i32; 4] = a.as_mut();
assert_eq!(a_mut, &mut [1, 2, 3, 4]);
a_mut[2] = 0;
assert_eq!(a_mut, &mut [1, 2, 0, 4]);
assert_eq!(a, arr![i32; 1, 2, 0, 4]);
}
#[test]
fn test_from_array_ref() {
let a = arr![i32; 1, 2, 3, 4];
let a_ref: &[i32; 4] = a.as_ref();
let a_from: &GenericArray<i32, U4> = a_ref.into();
assert_eq!(&a, a_from);
}
#[test]
fn test_from_array_mut() {
let mut a = arr![i32; 1, 2, 3, 4];
let mut a_copy = a;
let a_mut: &mut [i32; 4] = a.as_mut();
let a_from: &mut GenericArray<i32, U4> = a_mut.into();
assert_eq!(&mut a_copy, a_from);
}

View File

@ -1,2 +1,2 @@
Main developer:
Main developer:
* Sébastien Crozet <developer@crozet.re>

View File

@ -1,7 +1,7 @@
# v0.1.12
## Added
- Add `SystemTime` which works in both native and WASM environments.
## Modified
- The `now` function is always available now: there is no need to enable the `now` feature any more. The `now` feature
# v0.1.12
## Added
- Add `SystemTime` which works in both native and WASM environments.
## Modified
- The `now` function is always available now: there is no need to enable the `now` feature any more. The `now` feature
still exists (but doesnt do anything) for backwards compatibility.

View File

@ -1,27 +1,27 @@
Copyright (c) 2019, Sébastien Crozet
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the author nor the names of its contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copyright (c) 2019, Sébastien Crozet
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the author nor the names of its contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,143 +1,143 @@
# Instant
If you call `std::time::Instant::now()` on a WASM platform, it will panic. This crate provides a partial
replacement for `std::time::Instant` that works on WASM too. This defines the type `instant::Instant` which is:
* A struct emulating the behavior of **std::time::Instant** if you are targeting `wasm32-unknown-unknown` or `wasm32-unknown-asmjs`
**and** you enabled either the `stdweb` or the `wasm-bindgen` feature. This emulation is based on the javascript `performance.now()` function.
* A type alias for `std::time::Instant` otherwise.
Note that even if the **stdweb** or **wasm-bindgen** feature is enabled, this crate will continue to rely on `std::time::Instant`
as long as you are not targeting wasm32. This allows for portable code that will work on both native and WASM platforms.
This crate also exports the function `instant::now()` which returns a representation of the current time as an `f64`, expressed in milliseconds, in a platform-agnostic way. `instant::now()` will either:
* Call `performance.now()` when compiling for a WASM platform with the features **stdweb** or **wasm-bindgen** enabled, or using a custom javascript function.
* Return the time elapsed since the *Unix Epoch* on *native*, *non-WASM* platforms.
*Note*: The old feature, `now`, has been deprecated. `instant::now()` is always exported and the `now` feature flag no longer has any effect. It remains listed in `Cargo.toml` to avoid introducing breaking changes and may be removed in future versions.
## Examples
### Using `instant` for a native platform.
_Cargo.toml_:
```toml
[dependencies]
instant = "0.1"
```
_main.rs_:
```rust
fn main() {
// Will be the same as `std::time::Instant`.
let now = instant::Instant::now();
}
```
-----
### Using `instant` for a WASM platform.
This example shows the use of the `stdweb` feature. It would be similar with `wasm-bindgen`.
_Cargo.toml_:
```toml
[dependencies]
instant = { version = "0.1", features = [ "stdweb" ] }
```
_main.rs_:
```rust
fn main() {
// Will emulate `std::time::Instant` based on `performance.now()`.
let now = instant::Instant::now();
}
```
-----
### Using `instant` for a WASM platform where `performance.now()` is not available.
This example shows the use of the `inaccurate` feature.
_Cargo.toml_:
```toml
[dependencies]
instant = { version = "0.1", features = [ "wasm-bindgen", "inaccurate" ] }
```
_main.rs_:
```rust
fn main() {
// Will emulate `std::time::Instant` based on `Date.now()`.
let now = instant::Instant::now();
}
```
-----
### Using `instant` for any platform enabling a feature transitively.
_Cargo.toml_:
```toml
[features]
stdweb = [ "instant/stdweb" ]
wasm-bindgen = [ "instant/wasm-bindgen" ]
[dependencies]
instant = "0.1"
```
_lib.rs_:
```rust
fn my_function() {
// Will select the proper implementation depending on the
// feature selected by the user.
let now = instant::Instant::now();
}
```
-----
### Using `instant::now()`
_Cargo.toml_:
```toml
[features]
stdweb = [ "instant/stdweb" ]
wasm-bindgen = [ "instant/wasm-bindgen" ]
[dependencies]
instant = "0.1"
```
_lib.rs_:
```rust
fn my_function() {
// Will select the proper implementation depending on the
// feature selected by the user.
let now_instant = instant::Instant::now();
let now_milliseconds = instant::now(); // In milliseconds.
}
```
### Using the feature `now` without `stdweb` or `wasm-bindgen`.
_Cargo.toml_:
```toml
[dependencies]
instant = "0.1"
```
_lib.rs_:
```rust
fn my_function() {
// Will use the 'now' javascript implementation.
let now_instant = instant::Instant::now();
let now_milliseconds = instant::now(); // In milliseconds.
}
```
_javascript WASM bindings file_:
```js
function now() {
return Date.now() / 1000.0;
}
```
# Instant
If you call `std::time::Instant::now()` on a WASM platform, it will panic. This crate provides a partial
replacement for `std::time::Instant` that works on WASM too. This defines the type `instant::Instant` which is:
* A struct emulating the behavior of **std::time::Instant** if you are targeting `wasm32-unknown-unknown` or `wasm32-unknown-asmjs`
**and** you enabled either the `stdweb` or the `wasm-bindgen` feature. This emulation is based on the javascript `performance.now()` function.
* A type alias for `std::time::Instant` otherwise.
Note that even if the **stdweb** or **wasm-bindgen** feature is enabled, this crate will continue to rely on `std::time::Instant`
as long as you are not targeting wasm32. This allows for portable code that will work on both native and WASM platforms.
This crate also exports the function `instant::now()` which returns a representation of the current time as an `f64`, expressed in milliseconds, in a platform-agnostic way. `instant::now()` will either:
* Call `performance.now()` when compiling for a WASM platform with the features **stdweb** or **wasm-bindgen** enabled, or using a custom javascript function.
* Return the time elapsed since the *Unix Epoch* on *native*, *non-WASM* platforms.
*Note*: The old feature, `now`, has been deprecated. `instant::now()` is always exported and the `now` feature flag no longer has any effect. It remains listed in `Cargo.toml` to avoid introducing breaking changes and may be removed in future versions.
## Examples
### Using `instant` for a native platform.
_Cargo.toml_:
```toml
[dependencies]
instant = "0.1"
```
_main.rs_:
```rust
fn main() {
// Will be the same as `std::time::Instant`.
let now = instant::Instant::now();
}
```
-----
### Using `instant` for a WASM platform.
This example shows the use of the `stdweb` feature. It would be similar with `wasm-bindgen`.
_Cargo.toml_:
```toml
[dependencies]
instant = { version = "0.1", features = [ "stdweb" ] }
```
_main.rs_:
```rust
fn main() {
// Will emulate `std::time::Instant` based on `performance.now()`.
let now = instant::Instant::now();
}
```
-----
### Using `instant` for a WASM platform where `performance.now()` is not available.
This example shows the use of the `inaccurate` feature.
_Cargo.toml_:
```toml
[dependencies]
instant = { version = "0.1", features = [ "wasm-bindgen", "inaccurate" ] }
```
_main.rs_:
```rust
fn main() {
// Will emulate `std::time::Instant` based on `Date.now()`.
let now = instant::Instant::now();
}
```
-----
### Using `instant` for any platform enabling a feature transitively.
_Cargo.toml_:
```toml
[features]
stdweb = [ "instant/stdweb" ]
wasm-bindgen = [ "instant/wasm-bindgen" ]
[dependencies]
instant = "0.1"
```
_lib.rs_:
```rust
fn my_function() {
// Will select the proper implementation depending on the
// feature selected by the user.
let now = instant::Instant::now();
}
```
-----
### Using `instant::now()`
_Cargo.toml_:
```toml
[features]
stdweb = [ "instant/stdweb" ]
wasm-bindgen = [ "instant/wasm-bindgen" ]
[dependencies]
instant = "0.1"
```
_lib.rs_:
```rust
fn my_function() {
// Will select the proper implementation depending on the
// feature selected by the user.
let now_instant = instant::Instant::now();
let now_milliseconds = instant::now(); // In milliseconds.
}
```
### Using the feature `now` without `stdweb` or `wasm-bindgen`.
_Cargo.toml_:
```toml
[dependencies]
instant = "0.1"
```
_lib.rs_:
```rust
fn my_function() {
// Will use the 'now' javascript implementation.
let now_instant = instant::Instant::now();
let now_milliseconds = instant::now(); // In milliseconds.
}
```
_javascript WASM bindings file_:
```js
function now() {
return Date.now() / 1000.0;
}
```

View File

@ -1,22 +1,22 @@
cfg_if::cfg_if! {
if #[cfg(any(
all(target_arch = "wasm32", not(target_os = "wasi")),
target_arch = "asmjs"
))] {
#[cfg(all(feature = "stdweb", not(feature = "wasm-bindgen")))]
#[macro_use]
extern crate stdweb;
mod wasm;
pub use wasm::Instant;
pub use crate::wasm::now;
pub use wasm::SystemTime;
} else {
mod native;
pub use native::Instant;
pub use native::now;
pub use native::SystemTime;
}
}
pub use std::time::Duration;
cfg_if::cfg_if! {
if #[cfg(any(
all(target_arch = "wasm32", not(target_os = "wasi")),
target_arch = "asmjs"
))] {
#[cfg(all(feature = "stdweb", not(feature = "wasm-bindgen")))]
#[macro_use]
extern crate stdweb;
mod wasm;
pub use wasm::Instant;
pub use crate::wasm::now;
pub use wasm::SystemTime;
} else {
mod native;
pub use native::Instant;
pub use native::now;
pub use native::SystemTime;
}
}
pub use std::time::Duration;

View File

@ -1,9 +1,9 @@
pub type Instant = std::time::Instant;
pub type SystemTime = std::time::SystemTime;
/// The current time, expressed in milliseconds since the Unix Epoch.
pub fn now() -> f64 {
std::time::SystemTime::now().duration_since(std::time::SystemTime::UNIX_EPOCH)
.expect("System clock was before 1970.")
.as_secs_f64() * 1000.0
}
pub type Instant = std::time::Instant;
pub type SystemTime = std::time::SystemTime;
/// The current time, expressed in milliseconds since the Unix Epoch.
pub fn now() -> f64 {
std::time::SystemTime::now().duration_since(std::time::SystemTime::UNIX_EPOCH)
.expect("System clock was before 1970.")
.as_secs_f64() * 1000.0
}

View File

@ -1,240 +1,240 @@
use std::cmp::Ordering;
use std::ops::{Add, AddAssign, Sub, SubAssign};
use std::time::Duration;
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Hash)]
pub struct Instant(Duration);
impl Ord for Instant {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.partial_cmp(other)
.expect("an instant should never be NaN or Inf.")
}
}
impl Eq for Instant {}
impl Instant {
#[inline]
pub fn now() -> Self {
Instant(duration_from_f64(now()))
}
#[inline]
pub fn duration_since(&self, earlier: Instant) -> Duration {
assert!(
earlier.0 <= self.0,
"`earlier` cannot be later than `self`."
);
self.0 - earlier.0
}
#[inline]
pub fn elapsed(&self) -> Duration {
Self::now().duration_since(*self)
}
/// Returns `Some(t)` where `t` is the time `self + duration` if `t` can be represented as
/// `Instant` (which means it's inside the bounds of the underlying data structure), `None`
/// otherwise.
#[inline]
pub fn checked_add(&self, duration: Duration) -> Option<Instant> {
self.0.checked_add(duration).map(Instant)
}
/// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as
/// `Instant` (which means it's inside the bounds of the underlying data structure), `None`
/// otherwise.
#[inline]
pub fn checked_sub(&self, duration: Duration) -> Option<Instant> {
self.0.checked_sub(duration).map(Instant)
}
/// Returns the amount of time elapsed from another instant to this one, or None if that
/// instant is later than this one.
#[inline]
pub fn checked_duration_since(&self, earlier: Instant) -> Option<Duration> {
if earlier.0 > self.0 {
None
} else {
Some(self.0 - earlier.0)
}
}
/// Returns the amount of time elapsed from another instant to this one, or zero duration if
/// that instant is later than this one.
#[inline]
pub fn saturating_duration_since(&self, earlier: Instant) -> Duration {
self.checked_duration_since(earlier).unwrap_or_default()
}
}
impl Add<Duration> for Instant {
type Output = Self;
#[inline]
fn add(self, rhs: Duration) -> Self {
Instant(self.0 + rhs)
}
}
impl AddAssign<Duration> for Instant {
#[inline]
fn add_assign(&mut self, rhs: Duration) {
self.0 += rhs
}
}
impl Sub<Duration> for Instant {
type Output = Self;
#[inline]
fn sub(self, rhs: Duration) -> Self {
Instant(self.0 - rhs)
}
}
impl Sub<Instant> for Instant {
type Output = Duration;
#[inline]
fn sub(self, rhs: Instant) -> Duration {
self.duration_since(rhs)
}
}
impl SubAssign<Duration> for Instant {
#[inline]
fn sub_assign(&mut self, rhs: Duration) {
self.0 -= rhs
}
}
fn duration_from_f64(millis: f64) -> Duration {
Duration::from_millis(millis.trunc() as u64)
+ Duration::from_nanos((millis.fract() * 1.0e6) as u64)
}
#[cfg(all(feature = "stdweb", not(feature = "wasm-bindgen")))]
#[allow(unused_results)] // Needed because the js macro triggers it.
pub fn now() -> f64 {
use stdweb::unstable::TryInto;
// https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
#[cfg(not(feature = "inaccurate"))]
let v = js! { return performance.now(); };
#[cfg(feature = "inaccurate")]
let v = js! { return Date.now(); };
v.try_into().unwrap()
}
#[cfg(feature = "wasm-bindgen")]
pub fn now() -> f64 {
#[cfg(not(feature = "inaccurate"))]
let now = {
use wasm_bindgen_rs::prelude::*;
use wasm_bindgen_rs::JsCast;
js_sys::Reflect::get(&js_sys::global(), &JsValue::from_str("performance"))
.expect("failed to get performance from global object")
.unchecked_into::<web_sys::Performance>()
.now()
};
#[cfg(feature = "inaccurate")]
let now = js_sys::Date::now();
now
}
// The JS now function is in a module so it won't have to be renamed
#[cfg(not(any(feature = "wasm-bindgen", feature = "stdweb")))]
mod js {
extern "C" {
#[cfg(not(target_os = "emscripten"))]
pub fn now() -> f64;
#[cfg(target_os = "emscripten")]
pub fn _emscripten_get_now() -> f64;
}
}
// Make the unsafe extern function "safe" so it can be called like the other 'now' functions
#[cfg(not(any(feature = "wasm-bindgen", feature = "stdweb")))]
pub fn now() -> f64 {
#[cfg(not(target_os = "emscripten"))]
return unsafe { js::now() };
#[cfg(target_os = "emscripten")]
return unsafe { js::_emscripten_get_now() };
}
/// Returns the number of millisecods elapsed since January 1, 1970 00:00:00 UTC.
#[cfg(any(feature = "wasm-bindgen", feature = "stdweb"))]
fn get_time() -> f64 {
#[cfg(feature = "wasm-bindgen")]
return js_sys::Date::now();
#[cfg(all(feature = "stdweb", not(feature = "wasm-bindgen")))]
{
let v = js! { return Date.now(); };
return v.try_into().unwrap();
}
}
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
pub struct SystemTime(f64);
impl SystemTime {
pub const UNIX_EPOCH: SystemTime = SystemTime(0.0);
pub fn now() -> SystemTime {
cfg_if::cfg_if! {
if #[cfg(any(feature = "wasm-bindgen", feature = "stdweb"))] {
SystemTime(get_time())
} else {
SystemTime(now())
}
}
}
pub fn duration_since(&self, earlier: SystemTime) -> Result<Duration, ()> {
let dur_ms = self.0 - earlier.0;
if dur_ms < 0.0 {
return Err(());
}
Ok(Duration::from_millis(dur_ms as u64))
}
pub fn elapsed(&self) -> Result<Duration, ()> {
self.duration_since(SystemTime::now())
}
pub fn checked_add(&self, duration: Duration) -> Option<SystemTime> {
Some(*self + duration)
}
pub fn checked_sub(&self, duration: Duration) -> Option<SystemTime> {
Some(*self - duration)
}
}
impl Add<Duration> for SystemTime {
type Output = SystemTime;
fn add(self, other: Duration) -> SystemTime {
SystemTime(self.0 + other.as_millis() as f64)
}
}
impl Sub<Duration> for SystemTime {
type Output = SystemTime;
fn sub(self, other: Duration) -> SystemTime {
SystemTime(self.0 - other.as_millis() as f64)
}
}
impl AddAssign<Duration> for SystemTime {
fn add_assign(&mut self, rhs: Duration) {
*self = *self + rhs;
}
}
impl SubAssign<Duration> for SystemTime {
fn sub_assign(&mut self, rhs: Duration) {
*self = *self - rhs;
}
}
use std::cmp::Ordering;
use std::ops::{Add, AddAssign, Sub, SubAssign};
use std::time::Duration;
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Hash)]
pub struct Instant(Duration);
impl Ord for Instant {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.partial_cmp(other)
.expect("an instant should never be NaN or Inf.")
}
}
impl Eq for Instant {}
impl Instant {
#[inline]
pub fn now() -> Self {
Instant(duration_from_f64(now()))
}
#[inline]
pub fn duration_since(&self, earlier: Instant) -> Duration {
assert!(
earlier.0 <= self.0,
"`earlier` cannot be later than `self`."
);
self.0 - earlier.0
}
#[inline]
pub fn elapsed(&self) -> Duration {
Self::now().duration_since(*self)
}
/// Returns `Some(t)` where `t` is the time `self + duration` if `t` can be represented as
/// `Instant` (which means it's inside the bounds of the underlying data structure), `None`
/// otherwise.
#[inline]
pub fn checked_add(&self, duration: Duration) -> Option<Instant> {
self.0.checked_add(duration).map(Instant)
}
/// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as
/// `Instant` (which means it's inside the bounds of the underlying data structure), `None`
/// otherwise.
#[inline]
pub fn checked_sub(&self, duration: Duration) -> Option<Instant> {
self.0.checked_sub(duration).map(Instant)
}
/// Returns the amount of time elapsed from another instant to this one, or None if that
/// instant is later than this one.
#[inline]
pub fn checked_duration_since(&self, earlier: Instant) -> Option<Duration> {
if earlier.0 > self.0 {
None
} else {
Some(self.0 - earlier.0)
}
}
/// Returns the amount of time elapsed from another instant to this one, or zero duration if
/// that instant is later than this one.
#[inline]
pub fn saturating_duration_since(&self, earlier: Instant) -> Duration {
self.checked_duration_since(earlier).unwrap_or_default()
}
}
impl Add<Duration> for Instant {
type Output = Self;
#[inline]
fn add(self, rhs: Duration) -> Self {
Instant(self.0 + rhs)
}
}
impl AddAssign<Duration> for Instant {
#[inline]
fn add_assign(&mut self, rhs: Duration) {
self.0 += rhs
}
}
impl Sub<Duration> for Instant {
type Output = Self;
#[inline]
fn sub(self, rhs: Duration) -> Self {
Instant(self.0 - rhs)
}
}
impl Sub<Instant> for Instant {
type Output = Duration;
#[inline]
fn sub(self, rhs: Instant) -> Duration {
self.duration_since(rhs)
}
}
impl SubAssign<Duration> for Instant {
#[inline]
fn sub_assign(&mut self, rhs: Duration) {
self.0 -= rhs
}
}
fn duration_from_f64(millis: f64) -> Duration {
Duration::from_millis(millis.trunc() as u64)
+ Duration::from_nanos((millis.fract() * 1.0e6) as u64)
}
#[cfg(all(feature = "stdweb", not(feature = "wasm-bindgen")))]
#[allow(unused_results)] // Needed because the js macro triggers it.
pub fn now() -> f64 {
use stdweb::unstable::TryInto;
// https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
#[cfg(not(feature = "inaccurate"))]
let v = js! { return performance.now(); };
#[cfg(feature = "inaccurate")]
let v = js! { return Date.now(); };
v.try_into().unwrap()
}
#[cfg(feature = "wasm-bindgen")]
pub fn now() -> f64 {
#[cfg(not(feature = "inaccurate"))]
let now = {
use wasm_bindgen_rs::prelude::*;
use wasm_bindgen_rs::JsCast;
js_sys::Reflect::get(&js_sys::global(), &JsValue::from_str("performance"))
.expect("failed to get performance from global object")
.unchecked_into::<web_sys::Performance>()
.now()
};
#[cfg(feature = "inaccurate")]
let now = js_sys::Date::now();
now
}
// The JS now function is in a module so it won't have to be renamed
#[cfg(not(any(feature = "wasm-bindgen", feature = "stdweb")))]
mod js {
extern "C" {
#[cfg(not(target_os = "emscripten"))]
pub fn now() -> f64;
#[cfg(target_os = "emscripten")]
pub fn _emscripten_get_now() -> f64;
}
}
// Make the unsafe extern function "safe" so it can be called like the other 'now' functions
#[cfg(not(any(feature = "wasm-bindgen", feature = "stdweb")))]
pub fn now() -> f64 {
#[cfg(not(target_os = "emscripten"))]
return unsafe { js::now() };
#[cfg(target_os = "emscripten")]
return unsafe { js::_emscripten_get_now() };
}
/// Returns the number of millisecods elapsed since January 1, 1970 00:00:00 UTC.
#[cfg(any(feature = "wasm-bindgen", feature = "stdweb"))]
fn get_time() -> f64 {
#[cfg(feature = "wasm-bindgen")]
return js_sys::Date::now();
#[cfg(all(feature = "stdweb", not(feature = "wasm-bindgen")))]
{
let v = js! { return Date.now(); };
return v.try_into().unwrap();
}
}
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
pub struct SystemTime(f64);
impl SystemTime {
pub const UNIX_EPOCH: SystemTime = SystemTime(0.0);
pub fn now() -> SystemTime {
cfg_if::cfg_if! {
if #[cfg(any(feature = "wasm-bindgen", feature = "stdweb"))] {
SystemTime(get_time())
} else {
SystemTime(now())
}
}
}
pub fn duration_since(&self, earlier: SystemTime) -> Result<Duration, ()> {
let dur_ms = self.0 - earlier.0;
if dur_ms < 0.0 {
return Err(());
}
Ok(Duration::from_millis(dur_ms as u64))
}
pub fn elapsed(&self) -> Result<Duration, ()> {
self.duration_since(SystemTime::now())
}
pub fn checked_add(&self, duration: Duration) -> Option<SystemTime> {
Some(*self + duration)
}
pub fn checked_sub(&self, duration: Duration) -> Option<SystemTime> {
Some(*self - duration)
}
}
impl Add<Duration> for SystemTime {
type Output = SystemTime;
fn add(self, other: Duration) -> SystemTime {
SystemTime(self.0 + other.as_millis() as f64)
}
}
impl Sub<Duration> for SystemTime {
type Output = SystemTime;
fn sub(self, other: Duration) -> SystemTime {
SystemTime(self.0 - other.as_millis() as f64)
}
}
impl AddAssign<Duration> for SystemTime {
fn add_assign(&mut self, rhs: Duration) {
*self = *self + rhs;
}
}
impl SubAssign<Duration> for SystemTime {
fn sub_assign(&mut self, rhs: Duration) {
*self = *self - rhs;
}
}

View File

@ -1,57 +1,57 @@
extern crate wasm_bindgen_test;
use instant::{Instant, SystemTime};
use std::time::Duration;
use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser);
// run these tests using: wasm-pack test --chrome --headless -- --features wasm-bindgen
#[wasm_bindgen_test]
fn test_instant_now() {
let now = Instant::now();
#[cfg(feature = "inaccurate")]
while now.elapsed().as_millis() == 0 {}
#[cfg(not(feature = "inaccurate"))]
assert!(now.elapsed().as_nanos() > 0);
}
#[wasm_bindgen_test]
fn test_duration() {
let now = Instant::now();
let one_sec = Duration::from_secs(1);
assert!(now.elapsed() < one_sec);
}
// Duration::new will overflow when you have u64::MAX seconds and one billion nanoseconds.
// <https://doc.rust-lang.org/std/time/struct.Duration.html#method.new>
const ONE_BILLION: u32 = 1_000_000_000;
#[wasm_bindgen_test]
fn test_checked_add() {
let now = Instant::now();
assert!(now.checked_add(Duration::from_millis(1)).is_some());
assert_eq!(
None,
now.checked_add(Duration::new(u64::MAX, ONE_BILLION - 1))
);
}
#[wasm_bindgen_test]
fn test_checked_sub() {
let now = Instant::now();
assert!(now.checked_sub(Duration::from_millis(1)).is_some());
assert!(now
.checked_sub(Duration::new(u64::MAX, ONE_BILLION - 1))
.is_none());
}
#[wasm_bindgen_test]
fn test_system_time() {
assert!(SystemTime::UNIX_EPOCH
.duration_since(SystemTime::now())
.is_err());
}
extern crate wasm_bindgen_test;
use instant::{Instant, SystemTime};
use std::time::Duration;
use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser);
// run these tests using: wasm-pack test --chrome --headless -- --features wasm-bindgen
#[wasm_bindgen_test]
fn test_instant_now() {
let now = Instant::now();
#[cfg(feature = "inaccurate")]
while now.elapsed().as_millis() == 0 {}
#[cfg(not(feature = "inaccurate"))]
assert!(now.elapsed().as_nanos() > 0);
}
#[wasm_bindgen_test]
fn test_duration() {
let now = Instant::now();
let one_sec = Duration::from_secs(1);
assert!(now.elapsed() < one_sec);
}
// Duration::new will overflow when you have u64::MAX seconds and one billion nanoseconds.
// <https://doc.rust-lang.org/std/time/struct.Duration.html#method.new>
const ONE_BILLION: u32 = 1_000_000_000;
#[wasm_bindgen_test]
fn test_checked_add() {
let now = Instant::now();
assert!(now.checked_add(Duration::from_millis(1)).is_some());
assert_eq!(
None,
now.checked_add(Duration::new(u64::MAX, ONE_BILLION - 1))
);
}
#[wasm_bindgen_test]
fn test_checked_sub() {
let now = Instant::now();
assert!(now.checked_sub(Duration::from_millis(1)).is_some());
assert!(now
.checked_sub(Duration::new(u64::MAX, ONE_BILLION - 1))
.is_none());
}
#[wasm_bindgen_test]
fn test_system_time() {
assert!(SystemTime::UNIX_EPOCH
.duration_since(SystemTime::now())
.is_err());
}

View File

@ -1,7 +1,7 @@
s! {
pub struct user_fpsimd_struct {
pub vregs: [::__uint128_t; 32],
pub fpsr: u32,
pub fpcr: u32,
}
}
s! {
pub struct user_fpsimd_struct {
pub vregs: [::__uint128_t; 32],
pub fpsr: u32,
pub fpcr: u32,
}
}

View File

@ -1,7 +1,7 @@
s! {
pub struct user_fpsimd_struct {
pub vregs: [::__uint128_t; 32],
pub fpsr: u32,
pub fpcr: u32,
}
}
s! {
pub struct user_fpsimd_struct {
pub vregs: [::__uint128_t; 32],
pub fpsr: u32,
pub fpcr: u32,
}
}

View File

@ -1,7 +1,7 @@
s! {
pub struct user_fpsimd_struct {
pub vregs: [::__uint128_t; 32],
pub fpsr: u32,
pub fpcr: u32,
}
}
s! {
pub struct user_fpsimd_struct {
pub vregs: [::__uint128_t; 32],
pub fpsr: u32,
pub fpcr: u32,
}
}

View File

@ -1,241 +1,241 @@
# Change Log
## [Unreleased]
## [0.4.17] - 2022-04-29
* Update `kv_unstable` internal dependencies.
## [0.4.16] - 2022-03-22
* Fix a conflict with unqualified `Option` use in macros.
## [0.4.15] - 2022-02-23
* Silence a warning about the deprecated `spin_loop_hint`.
* Relax ordering in the atomic `set_max_level` call.
* Add thumbv4t-none-eabi to targets that don't support atomics
* Allow levels to be iterated over.
* Implement `Log` on some common wrapper types.
* Improvements to test coverage.
* Improvements to documentation.
* Add key-value support to the `log!` macros.
* Tighten `kv_unstable` internal dependencies so they don't bump past their current alpha.
* Add a simple visit API to `kv_unstable`.
* Support `NonZero*` integers as values in structured logging
* Support static strings as keys in structured logging
## [0.4.14] - 2021-01-27
* Remove the `__private_api_log_lit` special case.
* Fixed incorrect combination of `kv_unstable` and `std` features causing compile failures.
* Remove unstable `Value::to_*` conversions that were incorrectly using `as`.
* Rename unstable `Value::to_error` to `Value::to_borrowed_error`.
## [0.4.13] - 2021-01-11
* This is the same as `0.4.11`, except with a `kv_unstable_std` feature added to aid migrating current dependents to `0.4.14` (which was originally going to be `0.4.13` until it was decided to create a patch from `0.4.11` to minimize disruption).
## [0.4.12] - 2020-12-24
### New
* Support platforms without atomics by racing instead of failing to compile
* Implement `Log` for `Box<T: Log>`
* Update `cfg-if` to `1.0`
* Internal reworks of the structured logging API. Removed the `Fill` API
and added `source::as_map` and `source::as_list` to easily serialize a `Source`
as either a map of `{key: value, ..}` or as a list of `[(key, value), ..]`.
### Fixed
* Fixed deserialization of `LevelFilter` to use their `u64` index variants
## [0.4.11] - 2020-07-09
### New
* Support coercing structured values into concrete types.
* Reference the `win_dbg_logger` in the readme.
### Fixed
* Updates a few deprecated items used internally.
* Fixed issues in docs and expands sections.
* Show the correct build badge in the readme.
* Fix up a possible inference breakage with structured value errors.
* Respect formatting flags in structured value formatting.
## [0.4.10] - 2019-12-16 (yanked)
### Fixed
* Fixed the `log!` macros so they work in expression context (this regressed in `0.4.9`, which has been yanked).
## [0.4.9] - 2019-12-12 (yanked)
### Minimum Supported Rust Version
This release bumps the minimum compiler version to `1.31.0`. This was mainly needed for `cfg-if`,
but between `1.16.0` and `1.31.0` there are a lot of language and library improvements we now
take advantage of.
### New
* Unstable support for capturing key-value pairs in a record using the `log!` macros
### Improved
* Better documentation for max level filters.
* Internal updates to line up with bumped MSRV
## [0.4.8] - 2019-07-28
### New
* Support attempting to get `Record` fields as static strings.
## [0.4.7] - 2019-07-06
### New
* Support for embedded environments with thread-unsafe initialization.
* Initial unstable support for capturing structured data under the `kv_unstable`
feature gate. This new API doesn't affect existing users and may change in future
patches (so those changes may not appear in the changelog until it stabilizes).
### Improved
* Docs for using `log` with the 2018 edition.
* Error messages for macros missing arguments.
## [0.4.6] - 2018-10-27
### Improved
* Support 2018-style macro import for the `log_enabled!` macro.
## [0.4.5] - 2018-09-03
### Improved
* Make `log`'s internal helper macros less likely to conflict with user-defined
macros.
## [0.4.4] - 2018-08-17
### Improved
* Support 2018-style imports of the log macros.
## [0.4.3] - 2018-06-29
### Improved
* More code generation improvements.
## [0.4.2] - 2018-06-05
### Improved
* Log invocations now generate less code.
### Fixed
* Example Logger implementations now properly set the max log level.
## [0.4.1] - 2017-12-30
### Fixed
* Some doc links were fixed.
## [0.4.0] - 2017-12-24
The changes in this release include cleanup of some obscure functionality and a more robust public
API designed to support bridges to other logging systems, and provide more flexibility to new
features in the future.
### Compatibility
Vast portions of the Rust ecosystem use the 0.3.x release series of log, and we don't want to force
the community to go through the pain of upgrading every crate to 0.4.x at the exact same time. Along
with 0.4.0, we've published a new 0.3.9 release which acts as a "shim" over 0.4.0. This will allow
crates using either version to coexist without losing messages from one side or the other.
There is one caveat - a log message generated by a crate using 0.4.x but consumed by a logging
implementation using 0.3.x will not have a file name or module path. Applications affected by this
can upgrade their logging implementations to one using 0.4.x to avoid losing this information. The
other direction does not lose any information, fortunately!
**TL;DR** Libraries should feel comfortable upgrading to 0.4.0 without treating that as a breaking
change. Applications may need to update their logging implementation (e.g. env-logger) to a newer
version using log 0.4.x to avoid losing module and file information.
### New
* The crate is now `no_std` by default.
* `Level` and `LevelFilter` now implement `Serialize` and `Deserialize` when the `serde` feature is
enabled.
* The `Record` and `Metadata` types can now be constructed by third-party code via a builder API.
* The `logger` free function returns a reference to the logger implementation. This, along with the
ability to construct `Record`s, makes it possible to bridge from another logging framework to
this one without digging into the private internals of the crate. The standard `error!` `warn!`,
etc, macros now exclusively use the public API of the crate rather than "secret" internal APIs.
* `Log::flush` has been added to allow crates to tell the logging implementation to ensure that all
"in flight" log events have been persisted. This can be used, for example, just before an
application exits to ensure that asynchronous log sinks finish their work.
### Removed
* The `shutdown` and `shutdown_raw` functions have been removed. Supporting shutdown significantly
complicated the implementation and imposed a performance cost on each logging operation.
* The `log_panics` function and its associated `nightly` Cargo feature have been removed. Use the
[log-panics](https://crates.io/crates/log-panics) instead.
### Changed
* The `Log` prefix has been removed from type names. For example, `LogLevelFilter` is now
`LevelFilter`, and `LogRecord` is now `Record`.
* The `MaxLogLevelFilter` object has been removed in favor of a `set_max_level` free function.
* The `set_logger` free functions have been restructured. The logger is now directly passed to the
functions rather than a closure which returns the logger. `set_logger` now takes a `&'static
Log` and is usable in `no_std` contexts in place of the old `set_logger_raw`. `set_boxed_logger`
is a convenience function which takes a `Box<Log>` but otherwise acts like `set_logger`. It
requires the `std` feature.
* The `file` and `module_path` values in `Record` no longer have the `'static` lifetime to support
integration with other logging frameworks that don't provide a `'static` lifetime for the
equivalent values.
* The `file`, `line`, and `module_path` values in `Record` are now `Option`s to support integration
with other logging frameworks that don't provide those values.
### In the Future
* We're looking to add support for *structured* logging - the inclusion of extra key-value pairs of
information in a log event in addition to the normal string message. This should be able to be
added in a backwards compatible manner to the 0.4.x series when the design is worked out.
## Older
Look at the [release tags] for information about older releases.
[Unreleased]: https://github.com/rust-lang-nursery/log/compare/0.4.17...HEAD
[0.4.17]: https://github.com/rust-lang-nursery/log/compare/0.4.16...0.4.17
[0.4.16]: https://github.com/rust-lang-nursery/log/compare/0.4.15...0.4.16
[0.4.15]: https://github.com/rust-lang-nursery/log/compare/0.4.13...0.4.15
[0.4.14]: https://github.com/rust-lang-nursery/log/compare/0.4.13...0.4.14
[0.4.13]: https://github.com/rust-lang-nursery/log/compare/0.4.11...0.4.13
[0.4.12]: https://github.com/rust-lang-nursery/log/compare/0.4.11...0.4.12
[0.4.11]: https://github.com/rust-lang-nursery/log/compare/0.4.10...0.4.11
[0.4.10]: https://github.com/rust-lang-nursery/log/compare/0.4.9...0.4.10
[0.4.9]: https://github.com/rust-lang-nursery/log/compare/0.4.8...0.4.9
[0.4.8]: https://github.com/rust-lang-nursery/log/compare/0.4.7...0.4.8
[0.4.7]: https://github.com/rust-lang-nursery/log/compare/0.4.6...0.4.7
[0.4.6]: https://github.com/rust-lang-nursery/log/compare/0.4.5...0.4.6
[0.4.5]: https://github.com/rust-lang-nursery/log/compare/0.4.4...0.4.5
[0.4.4]: https://github.com/rust-lang-nursery/log/compare/0.4.3...0.4.4
[0.4.3]: https://github.com/rust-lang-nursery/log/compare/0.4.2...0.4.3
[0.4.2]: https://github.com/rust-lang-nursery/log/compare/0.4.1...0.4.2
[0.4.1]: https://github.com/rust-lang-nursery/log/compare/0.4.0...0.4.1
[0.4.0]: https://github.com/rust-lang-nursery/log/compare/0.3.8...0.4.0
[release tags]: https://github.com/rust-lang-nursery/log/releases
# Change Log
## [Unreleased]
## [0.4.17] - 2022-04-29
* Update `kv_unstable` internal dependencies.
## [0.4.16] - 2022-03-22
* Fix a conflict with unqualified `Option` use in macros.
## [0.4.15] - 2022-02-23
* Silence a warning about the deprecated `spin_loop_hint`.
* Relax ordering in the atomic `set_max_level` call.
* Add thumbv4t-none-eabi to targets that don't support atomics
* Allow levels to be iterated over.
* Implement `Log` on some common wrapper types.
* Improvements to test coverage.
* Improvements to documentation.
* Add key-value support to the `log!` macros.
* Tighten `kv_unstable` internal dependencies so they don't bump past their current alpha.
* Add a simple visit API to `kv_unstable`.
* Support `NonZero*` integers as values in structured logging
* Support static strings as keys in structured logging
## [0.4.14] - 2021-01-27
* Remove the `__private_api_log_lit` special case.
* Fixed incorrect combination of `kv_unstable` and `std` features causing compile failures.
* Remove unstable `Value::to_*` conversions that were incorrectly using `as`.
* Rename unstable `Value::to_error` to `Value::to_borrowed_error`.
## [0.4.13] - 2021-01-11
* This is the same as `0.4.11`, except with a `kv_unstable_std` feature added to aid migrating current dependents to `0.4.14` (which was originally going to be `0.4.13` until it was decided to create a patch from `0.4.11` to minimize disruption).
## [0.4.12] - 2020-12-24
### New
* Support platforms without atomics by racing instead of failing to compile
* Implement `Log` for `Box<T: Log>`
* Update `cfg-if` to `1.0`
* Internal reworks of the structured logging API. Removed the `Fill` API
and added `source::as_map` and `source::as_list` to easily serialize a `Source`
as either a map of `{key: value, ..}` or as a list of `[(key, value), ..]`.
### Fixed
* Fixed deserialization of `LevelFilter` to use their `u64` index variants
## [0.4.11] - 2020-07-09
### New
* Support coercing structured values into concrete types.
* Reference the `win_dbg_logger` in the readme.
### Fixed
* Updates a few deprecated items used internally.
* Fixed issues in docs and expands sections.
* Show the correct build badge in the readme.
* Fix up a possible inference breakage with structured value errors.
* Respect formatting flags in structured value formatting.
## [0.4.10] - 2019-12-16 (yanked)
### Fixed
* Fixed the `log!` macros so they work in expression context (this regressed in `0.4.9`, which has been yanked).
## [0.4.9] - 2019-12-12 (yanked)
### Minimum Supported Rust Version
This release bumps the minimum compiler version to `1.31.0`. This was mainly needed for `cfg-if`,
but between `1.16.0` and `1.31.0` there are a lot of language and library improvements we now
take advantage of.
### New
* Unstable support for capturing key-value pairs in a record using the `log!` macros
### Improved
* Better documentation for max level filters.
* Internal updates to line up with bumped MSRV
## [0.4.8] - 2019-07-28
### New
* Support attempting to get `Record` fields as static strings.
## [0.4.7] - 2019-07-06
### New
* Support for embedded environments with thread-unsafe initialization.
* Initial unstable support for capturing structured data under the `kv_unstable`
feature gate. This new API doesn't affect existing users and may change in future
patches (so those changes may not appear in the changelog until it stabilizes).
### Improved
* Docs for using `log` with the 2018 edition.
* Error messages for macros missing arguments.
## [0.4.6] - 2018-10-27
### Improved
* Support 2018-style macro import for the `log_enabled!` macro.
## [0.4.5] - 2018-09-03
### Improved
* Make `log`'s internal helper macros less likely to conflict with user-defined
macros.
## [0.4.4] - 2018-08-17
### Improved
* Support 2018-style imports of the log macros.
## [0.4.3] - 2018-06-29
### Improved
* More code generation improvements.
## [0.4.2] - 2018-06-05
### Improved
* Log invocations now generate less code.
### Fixed
* Example Logger implementations now properly set the max log level.
## [0.4.1] - 2017-12-30
### Fixed
* Some doc links were fixed.
## [0.4.0] - 2017-12-24
The changes in this release include cleanup of some obscure functionality and a more robust public
API designed to support bridges to other logging systems, and provide more flexibility to new
features in the future.
### Compatibility
Vast portions of the Rust ecosystem use the 0.3.x release series of log, and we don't want to force
the community to go through the pain of upgrading every crate to 0.4.x at the exact same time. Along
with 0.4.0, we've published a new 0.3.9 release which acts as a "shim" over 0.4.0. This will allow
crates using either version to coexist without losing messages from one side or the other.
There is one caveat - a log message generated by a crate using 0.4.x but consumed by a logging
implementation using 0.3.x will not have a file name or module path. Applications affected by this
can upgrade their logging implementations to one using 0.4.x to avoid losing this information. The
other direction does not lose any information, fortunately!
**TL;DR** Libraries should feel comfortable upgrading to 0.4.0 without treating that as a breaking
change. Applications may need to update their logging implementation (e.g. env-logger) to a newer
version using log 0.4.x to avoid losing module and file information.
### New
* The crate is now `no_std` by default.
* `Level` and `LevelFilter` now implement `Serialize` and `Deserialize` when the `serde` feature is
enabled.
* The `Record` and `Metadata` types can now be constructed by third-party code via a builder API.
* The `logger` free function returns a reference to the logger implementation. This, along with the
ability to construct `Record`s, makes it possible to bridge from another logging framework to
this one without digging into the private internals of the crate. The standard `error!` `warn!`,
etc, macros now exclusively use the public API of the crate rather than "secret" internal APIs.
* `Log::flush` has been added to allow crates to tell the logging implementation to ensure that all
"in flight" log events have been persisted. This can be used, for example, just before an
application exits to ensure that asynchronous log sinks finish their work.
### Removed
* The `shutdown` and `shutdown_raw` functions have been removed. Supporting shutdown significantly
complicated the implementation and imposed a performance cost on each logging operation.
* The `log_panics` function and its associated `nightly` Cargo feature have been removed. Use the
[log-panics](https://crates.io/crates/log-panics) instead.
### Changed
* The `Log` prefix has been removed from type names. For example, `LogLevelFilter` is now
`LevelFilter`, and `LogRecord` is now `Record`.
* The `MaxLogLevelFilter` object has been removed in favor of a `set_max_level` free function.
* The `set_logger` free functions have been restructured. The logger is now directly passed to the
functions rather than a closure which returns the logger. `set_logger` now takes a `&'static
Log` and is usable in `no_std` contexts in place of the old `set_logger_raw`. `set_boxed_logger`
is a convenience function which takes a `Box<Log>` but otherwise acts like `set_logger`. It
requires the `std` feature.
* The `file` and `module_path` values in `Record` no longer have the `'static` lifetime to support
integration with other logging frameworks that don't provide a `'static` lifetime for the
equivalent values.
* The `file`, `line`, and `module_path` values in `Record` are now `Option`s to support integration
with other logging frameworks that don't provide those values.
### In the Future
* We're looking to add support for *structured* logging - the inclusion of extra key-value pairs of
information in a log event in addition to the normal string message. This should be able to be
added in a backwards compatible manner to the 0.4.x series when the design is worked out.
## Older
Look at the [release tags] for information about older releases.
[Unreleased]: https://github.com/rust-lang-nursery/log/compare/0.4.17...HEAD
[0.4.17]: https://github.com/rust-lang-nursery/log/compare/0.4.16...0.4.17
[0.4.16]: https://github.com/rust-lang-nursery/log/compare/0.4.15...0.4.16
[0.4.15]: https://github.com/rust-lang-nursery/log/compare/0.4.13...0.4.15
[0.4.14]: https://github.com/rust-lang-nursery/log/compare/0.4.13...0.4.14
[0.4.13]: https://github.com/rust-lang-nursery/log/compare/0.4.11...0.4.13
[0.4.12]: https://github.com/rust-lang-nursery/log/compare/0.4.11...0.4.12
[0.4.11]: https://github.com/rust-lang-nursery/log/compare/0.4.10...0.4.11
[0.4.10]: https://github.com/rust-lang-nursery/log/compare/0.4.9...0.4.10
[0.4.9]: https://github.com/rust-lang-nursery/log/compare/0.4.8...0.4.9
[0.4.8]: https://github.com/rust-lang-nursery/log/compare/0.4.7...0.4.8
[0.4.7]: https://github.com/rust-lang-nursery/log/compare/0.4.6...0.4.7
[0.4.6]: https://github.com/rust-lang-nursery/log/compare/0.4.5...0.4.6
[0.4.5]: https://github.com/rust-lang-nursery/log/compare/0.4.4...0.4.5
[0.4.4]: https://github.com/rust-lang-nursery/log/compare/0.4.3...0.4.4
[0.4.3]: https://github.com/rust-lang-nursery/log/compare/0.4.2...0.4.3
[0.4.2]: https://github.com/rust-lang-nursery/log/compare/0.4.1...0.4.2
[0.4.1]: https://github.com/rust-lang-nursery/log/compare/0.4.0...0.4.1
[0.4.0]: https://github.com/rust-lang-nursery/log/compare/0.3.8...0.4.0
[release tags]: https://github.com/rust-lang-nursery/log/releases

View File

@ -1,201 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,25 +1,25 @@
Copyright (c) 2014 The Rust Project Developers
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.
Copyright (c) 2014 The Rust Project Developers
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.

View File

@ -1,117 +1,117 @@
log
===
A Rust library providing a lightweight logging *facade*.
[![Build status](https://img.shields.io/github/workflow/status/rust-lang/log/CI/master)](https://github.com/rust-lang/log/actions)
[![Latest version](https://img.shields.io/crates/v/log.svg)](https://crates.io/crates/log)
[![Documentation](https://docs.rs/log/badge.svg)](https://docs.rs/log)
![License](https://img.shields.io/crates/l/log.svg)
* [`log` documentation](https://docs.rs/log)
A logging facade provides a single logging API that abstracts over the actual
logging implementation. Libraries can use the logging API provided by this
crate, and the consumer of those libraries can choose the logging
implementation that is most suitable for its use case.
## Minimum supported `rustc`
`1.31.0+`
This version is explicitly tested in CI and may be bumped in any release as needed. Maintaining compatibility with older compilers is a priority though, so the bar for bumping the minimum supported version is set very high. Any changes to the supported minimum version will be called out in the release notes.
## Usage
### In libraries
Libraries should link only to the `log` crate, and use the provided macros to
log whatever information will be useful to downstream consumers:
```toml
[dependencies]
log = "0.4"
```
```rust
use log::{info, trace, warn};
pub fn shave_the_yak(yak: &mut Yak) {
trace!("Commencing yak shaving");
loop {
match find_a_razor() {
Ok(razor) => {
info!("Razor located: {}", razor);
yak.shave(razor);
break;
}
Err(err) => {
warn!("Unable to locate a razor: {}, retrying", err);
}
}
}
}
```
### In executables
In order to produce log output, executables have to use a logger implementation compatible with the facade.
There are many available implementations to choose from, here are some of the most popular ones:
* Simple minimal loggers:
* [`env_logger`](https://docs.rs/env_logger/*/env_logger/)
* [`simple_logger`](https://docs.rs/simple_logger/*/simple_logger/)
* [`simplelog`](https://docs.rs/simplelog/*/simplelog/)
* [`pretty_env_logger`](https://docs.rs/pretty_env_logger/*/pretty_env_logger/)
* [`stderrlog`](https://docs.rs/stderrlog/*/stderrlog/)
* [`flexi_logger`](https://docs.rs/flexi_logger/*/flexi_logger/)
* Complex configurable frameworks:
* [`log4rs`](https://docs.rs/log4rs/*/log4rs/)
* [`fern`](https://docs.rs/fern/*/fern/)
* Adaptors for other facilities:
* [`syslog`](https://docs.rs/syslog/*/syslog/)
* [`systemd-journal-logger`](https://docs.rs/systemd-journal-logger/*/systemd_journal_logger/)
* [`slog-stdlog`](https://docs.rs/slog-stdlog/*/slog_stdlog/)
* [`android_log`](https://docs.rs/android_log/*/android_log/)
* [`win_dbg_logger`](https://docs.rs/win_dbg_logger/*/win_dbg_logger/)
* [`db_logger`](https://docs.rs/db_logger/*/db_logger/)
* For WebAssembly binaries:
* [`console_log`](https://docs.rs/console_log/*/console_log/)
* For dynamic libraries:
* You may need to construct [an FFI-safe wrapper over `log`](https://github.com/rust-lang/log/issues/421) to initialize in your libraries.
* Utilities:
* [`log_err`](https://docs.rs/log_err/*/log_err/)
Executables should choose a logger implementation and initialize it early in the
runtime of the program. Logger implementations will typically include a
function to do this. Any log messages generated before the logger is
initialized will be ignored.
The executable itself may use the `log` crate to log as well.
## Structured logging
If you enable the `kv_unstable` feature, you can associate structured data with your log records:
```rust
use log::{info, trace, warn, as_serde, as_error};
pub fn shave_the_yak(yak: &mut Yak) {
trace!(target = "yak_events", yak = as_serde!(yak); "Commencing yak shaving");
loop {
match find_a_razor() {
Ok(razor) => {
info!(razor = razor; "Razor located");
yak.shave(razor);
break;
}
Err(err) => {
warn!(err = as_error!(err); "Unable to locate a razor, retrying");
}
}
}
}
```
log
===
A Rust library providing a lightweight logging *facade*.
[![Build status](https://img.shields.io/github/workflow/status/rust-lang/log/CI/master)](https://github.com/rust-lang/log/actions)
[![Latest version](https://img.shields.io/crates/v/log.svg)](https://crates.io/crates/log)
[![Documentation](https://docs.rs/log/badge.svg)](https://docs.rs/log)
![License](https://img.shields.io/crates/l/log.svg)
* [`log` documentation](https://docs.rs/log)
A logging facade provides a single logging API that abstracts over the actual
logging implementation. Libraries can use the logging API provided by this
crate, and the consumer of those libraries can choose the logging
implementation that is most suitable for its use case.
## Minimum supported `rustc`
`1.31.0+`
This version is explicitly tested in CI and may be bumped in any release as needed. Maintaining compatibility with older compilers is a priority though, so the bar for bumping the minimum supported version is set very high. Any changes to the supported minimum version will be called out in the release notes.
## Usage
### In libraries
Libraries should link only to the `log` crate, and use the provided macros to
log whatever information will be useful to downstream consumers:
```toml
[dependencies]
log = "0.4"
```
```rust
use log::{info, trace, warn};
pub fn shave_the_yak(yak: &mut Yak) {
trace!("Commencing yak shaving");
loop {
match find_a_razor() {
Ok(razor) => {
info!("Razor located: {}", razor);
yak.shave(razor);
break;
}
Err(err) => {
warn!("Unable to locate a razor: {}, retrying", err);
}
}
}
}
```
### In executables
In order to produce log output, executables have to use a logger implementation compatible with the facade.
There are many available implementations to choose from, here are some of the most popular ones:
* Simple minimal loggers:
* [`env_logger`](https://docs.rs/env_logger/*/env_logger/)
* [`simple_logger`](https://docs.rs/simple_logger/*/simple_logger/)
* [`simplelog`](https://docs.rs/simplelog/*/simplelog/)
* [`pretty_env_logger`](https://docs.rs/pretty_env_logger/*/pretty_env_logger/)
* [`stderrlog`](https://docs.rs/stderrlog/*/stderrlog/)
* [`flexi_logger`](https://docs.rs/flexi_logger/*/flexi_logger/)
* Complex configurable frameworks:
* [`log4rs`](https://docs.rs/log4rs/*/log4rs/)
* [`fern`](https://docs.rs/fern/*/fern/)
* Adaptors for other facilities:
* [`syslog`](https://docs.rs/syslog/*/syslog/)
* [`systemd-journal-logger`](https://docs.rs/systemd-journal-logger/*/systemd_journal_logger/)
* [`slog-stdlog`](https://docs.rs/slog-stdlog/*/slog_stdlog/)
* [`android_log`](https://docs.rs/android_log/*/android_log/)
* [`win_dbg_logger`](https://docs.rs/win_dbg_logger/*/win_dbg_logger/)
* [`db_logger`](https://docs.rs/db_logger/*/db_logger/)
* For WebAssembly binaries:
* [`console_log`](https://docs.rs/console_log/*/console_log/)
* For dynamic libraries:
* You may need to construct [an FFI-safe wrapper over `log`](https://github.com/rust-lang/log/issues/421) to initialize in your libraries.
* Utilities:
* [`log_err`](https://docs.rs/log_err/*/log_err/)
Executables should choose a logger implementation and initialize it early in the
runtime of the program. Logger implementations will typically include a
function to do this. Any log messages generated before the logger is
initialized will be ignored.
The executable itself may use the `log` crate to log as well.
## Structured logging
If you enable the `kv_unstable` feature, you can associate structured data with your log records:
```rust
use log::{info, trace, warn, as_serde, as_error};
pub fn shave_the_yak(yak: &mut Yak) {
trace!(target = "yak_events", yak = as_serde!(yak); "Commencing yak shaving");
loop {
match find_a_razor() {
Ok(razor) => {
info!(razor = razor; "Razor located");
yak.shave(razor);
break;
}
Err(err) => {
warn!(err = as_error!(err); "Unable to locate a razor, retrying");
}
}
}
}
```

View File

@ -1,30 +1,30 @@
#![cfg(feature = "kv_unstable")]
#![feature(test)]
extern crate log;
extern crate test;
use log::kv::Value;
#[bench]
fn u8_to_value(b: &mut test::Bencher) {
b.iter(|| Value::from(1u8))
}
#[bench]
fn u8_to_value_debug(b: &mut test::Bencher) {
b.iter(|| Value::from_debug(&1u8))
}
#[bench]
fn str_to_value_debug(b: &mut test::Bencher) {
b.iter(|| Value::from_debug(&"a string"))
}
#[bench]
fn custom_to_value_debug(b: &mut test::Bencher) {
#[derive(Debug)]
struct A;
b.iter(|| Value::from_debug(&A))
}
#![cfg(feature = "kv_unstable")]
#![feature(test)]
extern crate log;
extern crate test;
use log::kv::Value;
#[bench]
fn u8_to_value(b: &mut test::Bencher) {
b.iter(|| Value::from(1u8))
}
#[bench]
fn u8_to_value_debug(b: &mut test::Bencher) {
b.iter(|| Value::from_debug(&1u8))
}
#[bench]
fn str_to_value_debug(b: &mut test::Bencher) {
b.iter(|| Value::from_debug(&"a string"))
}
#[bench]
fn custom_to_value_debug(b: &mut test::Bencher) {
#[derive(Debug)]
struct A;
b.iter(|| Value::from_debug(&A))
}

View File

@ -1,46 +1,46 @@
//! This build script detects target platforms that lack proper support for
//! atomics and sets `cfg` flags accordingly.
use std::env;
use std::str;
fn main() {
let target = match rustc_target() {
Some(target) => target,
None => return,
};
if target_has_atomic_cas(&target) {
println!("cargo:rustc-cfg=atomic_cas");
}
if target_has_atomics(&target) {
println!("cargo:rustc-cfg=has_atomics");
}
println!("cargo:rerun-if-changed=build.rs");
}
fn target_has_atomic_cas(target: &str) -> bool {
match &target[..] {
"thumbv6m-none-eabi"
| "msp430-none-elf"
| "riscv32i-unknown-none-elf"
| "riscv32imc-unknown-none-elf" => false,
_ => true,
}
}
fn target_has_atomics(target: &str) -> bool {
match &target[..] {
"thumbv4t-none-eabi"
| "msp430-none-elf"
| "riscv32i-unknown-none-elf"
| "riscv32imc-unknown-none-elf" => false,
_ => true,
}
}
fn rustc_target() -> Option<String> {
env::var("TARGET").ok()
}
//! This build script detects target platforms that lack proper support for
//! atomics and sets `cfg` flags accordingly.
use std::env;
use std::str;
fn main() {
let target = match rustc_target() {
Some(target) => target,
None => return,
};
if target_has_atomic_cas(&target) {
println!("cargo:rustc-cfg=atomic_cas");
}
if target_has_atomics(&target) {
println!("cargo:rustc-cfg=has_atomics");
}
println!("cargo:rerun-if-changed=build.rs");
}
fn target_has_atomic_cas(target: &str) -> bool {
match &target[..] {
"thumbv6m-none-eabi"
| "msp430-none-elf"
| "riscv32i-unknown-none-elf"
| "riscv32imc-unknown-none-elf" => false,
_ => true,
}
}
fn target_has_atomics(target: &str) -> bool {
match &target[..] {
"thumbv4t-none-eabi"
| "msp430-none-elf"
| "riscv32i-unknown-none-elf"
| "riscv32imc-unknown-none-elf" => false,
_ => true,
}
}
fn rustc_target() -> Option<String> {
env::var("TARGET").ok()
}

View File

@ -1,90 +1,90 @@
use std::fmt;
/// An error encountered while working with structured data.
#[derive(Debug)]
pub struct Error {
inner: Inner,
}
#[derive(Debug)]
enum Inner {
#[cfg(feature = "std")]
Boxed(std_support::BoxedError),
Msg(&'static str),
Value(value_bag::Error),
Fmt,
}
impl Error {
/// Create an error from a message.
pub fn msg(msg: &'static str) -> Self {
Error {
inner: Inner::Msg(msg),
}
}
// Not public so we don't leak the `value_bag` API
pub(super) fn from_value(err: value_bag::Error) -> Self {
Error {
inner: Inner::Value(err),
}
}
// Not public so we don't leak the `value_bag` API
pub(super) fn into_value(self) -> value_bag::Error {
match self.inner {
Inner::Value(err) => err,
#[cfg(feature = "kv_unstable_std")]
_ => value_bag::Error::boxed(self),
#[cfg(not(feature = "kv_unstable_std"))]
_ => value_bag::Error::msg("error inspecting a value"),
}
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use self::Inner::*;
match &self.inner {
#[cfg(feature = "std")]
&Boxed(ref err) => err.fmt(f),
&Value(ref err) => err.fmt(f),
&Msg(ref msg) => msg.fmt(f),
&Fmt => fmt::Error.fmt(f),
}
}
}
impl From<fmt::Error> for Error {
fn from(_: fmt::Error) -> Self {
Error { inner: Inner::Fmt }
}
}
#[cfg(feature = "std")]
mod std_support {
use super::*;
use std::{error, io};
pub(super) type BoxedError = Box<dyn error::Error + Send + Sync>;
impl Error {
/// Create an error from a standard error type.
pub fn boxed<E>(err: E) -> Self
where
E: Into<BoxedError>,
{
Error {
inner: Inner::Boxed(err.into()),
}
}
}
impl error::Error for Error {}
impl From<io::Error> for Error {
fn from(err: io::Error) -> Self {
Error::boxed(err)
}
}
}
use std::fmt;
/// An error encountered while working with structured data.
#[derive(Debug)]
pub struct Error {
inner: Inner,
}
#[derive(Debug)]
enum Inner {
#[cfg(feature = "std")]
Boxed(std_support::BoxedError),
Msg(&'static str),
Value(value_bag::Error),
Fmt,
}
impl Error {
/// Create an error from a message.
pub fn msg(msg: &'static str) -> Self {
Error {
inner: Inner::Msg(msg),
}
}
// Not public so we don't leak the `value_bag` API
pub(super) fn from_value(err: value_bag::Error) -> Self {
Error {
inner: Inner::Value(err),
}
}
// Not public so we don't leak the `value_bag` API
pub(super) fn into_value(self) -> value_bag::Error {
match self.inner {
Inner::Value(err) => err,
#[cfg(feature = "kv_unstable_std")]
_ => value_bag::Error::boxed(self),
#[cfg(not(feature = "kv_unstable_std"))]
_ => value_bag::Error::msg("error inspecting a value"),
}
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use self::Inner::*;
match &self.inner {
#[cfg(feature = "std")]
&Boxed(ref err) => err.fmt(f),
&Value(ref err) => err.fmt(f),
&Msg(ref msg) => msg.fmt(f),
&Fmt => fmt::Error.fmt(f),
}
}
}
impl From<fmt::Error> for Error {
fn from(_: fmt::Error) -> Self {
Error { inner: Inner::Fmt }
}
}
#[cfg(feature = "std")]
mod std_support {
use super::*;
use std::{error, io};
pub(super) type BoxedError = Box<dyn error::Error + Send + Sync>;
impl Error {
/// Create an error from a standard error type.
pub fn boxed<E>(err: E) -> Self
where
E: Into<BoxedError>,
{
Error {
inner: Inner::Boxed(err.into()),
}
}
}
impl error::Error for Error {}
impl From<io::Error> for Error {
fn from(err: io::Error) -> Self {
Error::boxed(err)
}
}
}

View File

@ -1,172 +1,172 @@
//! Structured keys.
use std::borrow::Borrow;
use std::cmp;
use std::fmt;
use std::hash;
/// A type that can be converted into a [`Key`](struct.Key.html).
pub trait ToKey {
/// Perform the conversion.
fn to_key(&self) -> Key;
}
impl<'a, T> ToKey for &'a T
where
T: ToKey + ?Sized,
{
fn to_key(&self) -> Key {
(**self).to_key()
}
}
impl<'k> ToKey for Key<'k> {
fn to_key(&self) -> Key {
Key { key: self.key }
}
}
impl ToKey for str {
fn to_key(&self) -> Key {
Key::from_str(self)
}
}
/// A key in a structured key-value pair.
#[derive(Clone)]
pub struct Key<'k> {
key: &'k str,
}
impl<'k> Key<'k> {
/// Get a key from a borrowed string.
pub fn from_str(key: &'k str) -> Self {
Key { key: key }
}
/// Get a borrowed string from this key.
pub fn as_str(&self) -> &str {
self.key
}
}
impl<'k> fmt::Debug for Key<'k> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.key.fmt(f)
}
}
impl<'k> fmt::Display for Key<'k> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.key.fmt(f)
}
}
impl<'k> hash::Hash for Key<'k> {
fn hash<H>(&self, state: &mut H)
where
H: hash::Hasher,
{
self.as_str().hash(state)
}
}
impl<'k, 'ko> PartialEq<Key<'ko>> for Key<'k> {
fn eq(&self, other: &Key<'ko>) -> bool {
self.as_str().eq(other.as_str())
}
}
impl<'k> Eq for Key<'k> {}
impl<'k, 'ko> PartialOrd<Key<'ko>> for Key<'k> {
fn partial_cmp(&self, other: &Key<'ko>) -> Option<cmp::Ordering> {
self.as_str().partial_cmp(other.as_str())
}
}
impl<'k> Ord for Key<'k> {
fn cmp(&self, other: &Self) -> cmp::Ordering {
self.as_str().cmp(other.as_str())
}
}
impl<'k> AsRef<str> for Key<'k> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'k> Borrow<str> for Key<'k> {
fn borrow(&self) -> &str {
self.as_str()
}
}
impl<'k> From<&'k str> for Key<'k> {
fn from(s: &'k str) -> Self {
Key::from_str(s)
}
}
#[cfg(feature = "std")]
mod std_support {
use super::*;
use std::borrow::Cow;
impl ToKey for String {
fn to_key(&self) -> Key {
Key::from_str(self)
}
}
impl<'a> ToKey for Cow<'a, str> {
fn to_key(&self) -> Key {
Key::from_str(self)
}
}
}
#[cfg(feature = "kv_unstable_sval")]
mod sval_support {
use super::*;
extern crate sval;
use self::sval::value::{self, Value};
impl<'a> Value for Key<'a> {
fn stream(&self, stream: &mut value::Stream) -> value::Result {
self.key.stream(stream)
}
}
}
#[cfg(feature = "kv_unstable_serde")]
mod serde_support {
use super::*;
extern crate serde;
use self::serde::{Serialize, Serializer};
impl<'a> Serialize for Key<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
self.key.serialize(serializer)
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn key_from_string() {
assert_eq!("a key", Key::from_str("a key").as_str());
}
}
//! Structured keys.
use std::borrow::Borrow;
use std::cmp;
use std::fmt;
use std::hash;
/// A type that can be converted into a [`Key`](struct.Key.html).
pub trait ToKey {
/// Perform the conversion.
fn to_key(&self) -> Key;
}
impl<'a, T> ToKey for &'a T
where
T: ToKey + ?Sized,
{
fn to_key(&self) -> Key {
(**self).to_key()
}
}
impl<'k> ToKey for Key<'k> {
fn to_key(&self) -> Key {
Key { key: self.key }
}
}
impl ToKey for str {
fn to_key(&self) -> Key {
Key::from_str(self)
}
}
/// A key in a structured key-value pair.
#[derive(Clone)]
pub struct Key<'k> {
key: &'k str,
}
impl<'k> Key<'k> {
/// Get a key from a borrowed string.
pub fn from_str(key: &'k str) -> Self {
Key { key: key }
}
/// Get a borrowed string from this key.
pub fn as_str(&self) -> &str {
self.key
}
}
impl<'k> fmt::Debug for Key<'k> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.key.fmt(f)
}
}
impl<'k> fmt::Display for Key<'k> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.key.fmt(f)
}
}
impl<'k> hash::Hash for Key<'k> {
fn hash<H>(&self, state: &mut H)
where
H: hash::Hasher,
{
self.as_str().hash(state)
}
}
impl<'k, 'ko> PartialEq<Key<'ko>> for Key<'k> {
fn eq(&self, other: &Key<'ko>) -> bool {
self.as_str().eq(other.as_str())
}
}
impl<'k> Eq for Key<'k> {}
impl<'k, 'ko> PartialOrd<Key<'ko>> for Key<'k> {
fn partial_cmp(&self, other: &Key<'ko>) -> Option<cmp::Ordering> {
self.as_str().partial_cmp(other.as_str())
}
}
impl<'k> Ord for Key<'k> {
fn cmp(&self, other: &Self) -> cmp::Ordering {
self.as_str().cmp(other.as_str())
}
}
impl<'k> AsRef<str> for Key<'k> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'k> Borrow<str> for Key<'k> {
fn borrow(&self) -> &str {
self.as_str()
}
}
impl<'k> From<&'k str> for Key<'k> {
fn from(s: &'k str) -> Self {
Key::from_str(s)
}
}
#[cfg(feature = "std")]
mod std_support {
use super::*;
use std::borrow::Cow;
impl ToKey for String {
fn to_key(&self) -> Key {
Key::from_str(self)
}
}
impl<'a> ToKey for Cow<'a, str> {
fn to_key(&self) -> Key {
Key::from_str(self)
}
}
}
#[cfg(feature = "kv_unstable_sval")]
mod sval_support {
use super::*;
extern crate sval;
use self::sval::value::{self, Value};
impl<'a> Value for Key<'a> {
fn stream(&self, stream: &mut value::Stream) -> value::Result {
self.key.stream(stream)
}
}
}
#[cfg(feature = "kv_unstable_serde")]
mod serde_support {
use super::*;
extern crate serde;
use self::serde::{Serialize, Serializer};
impl<'a> Serialize for Key<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
self.key.serialize(serializer)
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn key_from_string() {
assert_eq!("a key", Key::from_str("a key").as_str());
}
}

View File

@ -1,26 +1,26 @@
//! **UNSTABLE:** Structured key-value pairs.
//!
//! This module is unstable and breaking changes may be made
//! at any time. See [the tracking issue](https://github.com/rust-lang-nursery/log/issues/328)
//! for more details.
//!
//! Add the `kv_unstable` feature to your `Cargo.toml` to enable
//! this module:
//!
//! ```toml
//! [dependencies.log]
//! features = ["kv_unstable"]
//! ```
mod error;
mod key;
pub mod source;
pub mod value;
pub use self::error::Error;
pub use self::key::{Key, ToKey};
pub use self::source::{Source, Visitor};
#[doc(inline)]
pub use self::value::{ToValue, Value};
//! **UNSTABLE:** Structured key-value pairs.
//!
//! This module is unstable and breaking changes may be made
//! at any time. See [the tracking issue](https://github.com/rust-lang-nursery/log/issues/328)
//! for more details.
//!
//! Add the `kv_unstable` feature to your `Cargo.toml` to enable
//! this module:
//!
//! ```toml
//! [dependencies.log]
//! features = ["kv_unstable"]
//! ```
mod error;
mod key;
pub mod source;
pub mod value;
pub use self::error::Error;
pub use self::key::{Key, ToKey};
pub use self::source::{Source, Visitor};
#[doc(inline)]
pub use self::value::{ToValue, Value};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,280 +1,280 @@
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
/// The standard logging macro.
///
/// This macro will generically log with the specified `Level` and `format!`
/// based argument list.
///
/// # Examples
///
/// ```edition2018
/// use log::{log, Level};
///
/// # fn main() {
/// let data = (42, "Forty-two");
/// let private_data = "private";
///
/// log!(Level::Error, "Received errors: {}, {}", data.0, data.1);
/// log!(target: "app_events", Level::Warn, "App warning: {}, {}, {}",
/// data.0, data.1, private_data);
/// # }
/// ```
#[macro_export(local_inner_macros)]
macro_rules! log {
// log!(target: "my_target", Level::Info; key1 = 42, key2 = true; "a {} event", "log");
(target: $target:expr, $lvl:expr, $($key:tt = $value:expr),+; $($arg:tt)+) => ({
let lvl = $lvl;
if lvl <= $crate::STATIC_MAX_LEVEL && lvl <= $crate::max_level() {
$crate::__private_api_log(
__log_format_args!($($arg)+),
lvl,
&($target, __log_module_path!(), __log_file!(), __log_line!()),
$crate::__private_api::Option::Some(&[$((__log_key!($key), &$value)),+])
);
}
});
// log!(target: "my_target", Level::Info; "a {} event", "log");
(target: $target:expr, $lvl:expr, $($arg:tt)+) => ({
let lvl = $lvl;
if lvl <= $crate::STATIC_MAX_LEVEL && lvl <= $crate::max_level() {
$crate::__private_api_log(
__log_format_args!($($arg)+),
lvl,
&($target, __log_module_path!(), __log_file!(), __log_line!()),
$crate::__private_api::Option::None,
);
}
});
// log!(Level::Info, "a log event")
($lvl:expr, $($arg:tt)+) => (log!(target: __log_module_path!(), $lvl, $($arg)+));
}
/// Logs a message at the error level.
///
/// # Examples
///
/// ```edition2018
/// use log::error;
///
/// # fn main() {
/// let (err_info, port) = ("No connection", 22);
///
/// error!("Error: {} on port {}", err_info, port);
/// error!(target: "app_events", "App Error: {}, Port: {}", err_info, 22);
/// # }
/// ```
#[macro_export(local_inner_macros)]
macro_rules! error {
// error!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log")
// error!(target: "my_target", "a {} event", "log")
(target: $target:expr, $($arg:tt)+) => (log!(target: $target, $crate::Level::Error, $($arg)+));
// error!("a {} event", "log")
($($arg:tt)+) => (log!($crate::Level::Error, $($arg)+))
}
/// Logs a message at the warn level.
///
/// # Examples
///
/// ```edition2018
/// use log::warn;
///
/// # fn main() {
/// let warn_description = "Invalid Input";
///
/// warn!("Warning! {}!", warn_description);
/// warn!(target: "input_events", "App received warning: {}", warn_description);
/// # }
/// ```
#[macro_export(local_inner_macros)]
macro_rules! warn {
// warn!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log")
// warn!(target: "my_target", "a {} event", "log")
(target: $target:expr, $($arg:tt)+) => (log!(target: $target, $crate::Level::Warn, $($arg)+));
// warn!("a {} event", "log")
($($arg:tt)+) => (log!($crate::Level::Warn, $($arg)+))
}
/// Logs a message at the info level.
///
/// # Examples
///
/// ```edition2018
/// use log::info;
///
/// # fn main() {
/// # struct Connection { port: u32, speed: f32 }
/// let conn_info = Connection { port: 40, speed: 3.20 };
///
/// info!("Connected to port {} at {} Mb/s", conn_info.port, conn_info.speed);
/// info!(target: "connection_events", "Successfull connection, port: {}, speed: {}",
/// conn_info.port, conn_info.speed);
/// # }
/// ```
#[macro_export(local_inner_macros)]
macro_rules! info {
// info!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log")
// info!(target: "my_target", "a {} event", "log")
(target: $target:expr, $($arg:tt)+) => (log!(target: $target, $crate::Level::Info, $($arg)+));
// info!("a {} event", "log")
($($arg:tt)+) => (log!($crate::Level::Info, $($arg)+))
}
/// Logs a message at the debug level.
///
/// # Examples
///
/// ```edition2018
/// use log::debug;
///
/// # fn main() {
/// # struct Position { x: f32, y: f32 }
/// let pos = Position { x: 3.234, y: -1.223 };
///
/// debug!("New position: x: {}, y: {}", pos.x, pos.y);
/// debug!(target: "app_events", "New position: x: {}, y: {}", pos.x, pos.y);
/// # }
/// ```
#[macro_export(local_inner_macros)]
macro_rules! debug {
// debug!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log")
// debug!(target: "my_target", "a {} event", "log")
(target: $target:expr, $($arg:tt)+) => (log!(target: $target, $crate::Level::Debug, $($arg)+));
// debug!("a {} event", "log")
($($arg:tt)+) => (log!($crate::Level::Debug, $($arg)+))
}
/// Logs a message at the trace level.
///
/// # Examples
///
/// ```edition2018
/// use log::trace;
///
/// # fn main() {
/// # struct Position { x: f32, y: f32 }
/// let pos = Position { x: 3.234, y: -1.223 };
///
/// trace!("Position is: x: {}, y: {}", pos.x, pos.y);
/// trace!(target: "app_events", "x is {} and y is {}",
/// if pos.x >= 0.0 { "positive" } else { "negative" },
/// if pos.y >= 0.0 { "positive" } else { "negative" });
/// # }
/// ```
#[macro_export(local_inner_macros)]
macro_rules! trace {
// trace!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log")
// trace!(target: "my_target", "a {} event", "log")
(target: $target:expr, $($arg:tt)+) => (log!(target: $target, $crate::Level::Trace, $($arg)+));
// trace!("a {} event", "log")
($($arg:tt)+) => (log!($crate::Level::Trace, $($arg)+))
}
/// Determines if a message logged at the specified level in that module will
/// be logged.
///
/// This can be used to avoid expensive computation of log message arguments if
/// the message would be ignored anyway.
///
/// # Examples
///
/// ```edition2018
/// use log::Level::Debug;
/// use log::{debug, log_enabled};
///
/// # fn foo() {
/// if log_enabled!(Debug) {
/// let data = expensive_call();
/// debug!("expensive debug data: {} {}", data.x, data.y);
/// }
/// if log_enabled!(target: "Global", Debug) {
/// let data = expensive_call();
/// debug!(target: "Global", "expensive debug data: {} {}", data.x, data.y);
/// }
/// # }
/// # struct Data { x: u32, y: u32 }
/// # fn expensive_call() -> Data { Data { x: 0, y: 0 } }
/// # fn main() {}
/// ```
#[macro_export(local_inner_macros)]
macro_rules! log_enabled {
(target: $target:expr, $lvl:expr) => {{
let lvl = $lvl;
lvl <= $crate::STATIC_MAX_LEVEL
&& lvl <= $crate::max_level()
&& $crate::__private_api_enabled(lvl, $target)
}};
($lvl:expr) => {
log_enabled!(target: __log_module_path!(), $lvl)
};
}
// The log macro above cannot invoke format_args directly because it uses
// local_inner_macros. A format_args invocation there would resolve to
// $crate::format_args which does not exist. Instead invoke format_args here
// outside of local_inner_macros so that it resolves (probably) to
// core::format_args or std::format_args. Same for the several macros that
// follow.
//
// This is a workaround until we drop support for pre-1.30 compilers. At that
// point we can remove use of local_inner_macros, use $crate:: when invoking
// local macros, and invoke format_args directly.
#[doc(hidden)]
#[macro_export]
macro_rules! __log_format_args {
($($args:tt)*) => {
format_args!($($args)*)
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __log_module_path {
() => {
module_path!()
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __log_file {
() => {
file!()
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __log_line {
() => {
line!()
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __log_key {
// key1 = 42
($($args:ident)*) => {
stringify!($($args)*)
};
// "key1" = 42
($($args:expr)*) => {
$($args)*
};
}
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
/// The standard logging macro.
///
/// This macro will generically log with the specified `Level` and `format!`
/// based argument list.
///
/// # Examples
///
/// ```edition2018
/// use log::{log, Level};
///
/// # fn main() {
/// let data = (42, "Forty-two");
/// let private_data = "private";
///
/// log!(Level::Error, "Received errors: {}, {}", data.0, data.1);
/// log!(target: "app_events", Level::Warn, "App warning: {}, {}, {}",
/// data.0, data.1, private_data);
/// # }
/// ```
#[macro_export(local_inner_macros)]
macro_rules! log {
// log!(target: "my_target", Level::Info; key1 = 42, key2 = true; "a {} event", "log");
(target: $target:expr, $lvl:expr, $($key:tt = $value:expr),+; $($arg:tt)+) => ({
let lvl = $lvl;
if lvl <= $crate::STATIC_MAX_LEVEL && lvl <= $crate::max_level() {
$crate::__private_api_log(
__log_format_args!($($arg)+),
lvl,
&($target, __log_module_path!(), __log_file!(), __log_line!()),
$crate::__private_api::Option::Some(&[$((__log_key!($key), &$value)),+])
);
}
});
// log!(target: "my_target", Level::Info; "a {} event", "log");
(target: $target:expr, $lvl:expr, $($arg:tt)+) => ({
let lvl = $lvl;
if lvl <= $crate::STATIC_MAX_LEVEL && lvl <= $crate::max_level() {
$crate::__private_api_log(
__log_format_args!($($arg)+),
lvl,
&($target, __log_module_path!(), __log_file!(), __log_line!()),
$crate::__private_api::Option::None,
);
}
});
// log!(Level::Info, "a log event")
($lvl:expr, $($arg:tt)+) => (log!(target: __log_module_path!(), $lvl, $($arg)+));
}
/// Logs a message at the error level.
///
/// # Examples
///
/// ```edition2018
/// use log::error;
///
/// # fn main() {
/// let (err_info, port) = ("No connection", 22);
///
/// error!("Error: {} on port {}", err_info, port);
/// error!(target: "app_events", "App Error: {}, Port: {}", err_info, 22);
/// # }
/// ```
#[macro_export(local_inner_macros)]
macro_rules! error {
// error!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log")
// error!(target: "my_target", "a {} event", "log")
(target: $target:expr, $($arg:tt)+) => (log!(target: $target, $crate::Level::Error, $($arg)+));
// error!("a {} event", "log")
($($arg:tt)+) => (log!($crate::Level::Error, $($arg)+))
}
/// Logs a message at the warn level.
///
/// # Examples
///
/// ```edition2018
/// use log::warn;
///
/// # fn main() {
/// let warn_description = "Invalid Input";
///
/// warn!("Warning! {}!", warn_description);
/// warn!(target: "input_events", "App received warning: {}", warn_description);
/// # }
/// ```
#[macro_export(local_inner_macros)]
macro_rules! warn {
// warn!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log")
// warn!(target: "my_target", "a {} event", "log")
(target: $target:expr, $($arg:tt)+) => (log!(target: $target, $crate::Level::Warn, $($arg)+));
// warn!("a {} event", "log")
($($arg:tt)+) => (log!($crate::Level::Warn, $($arg)+))
}
/// Logs a message at the info level.
///
/// # Examples
///
/// ```edition2018
/// use log::info;
///
/// # fn main() {
/// # struct Connection { port: u32, speed: f32 }
/// let conn_info = Connection { port: 40, speed: 3.20 };
///
/// info!("Connected to port {} at {} Mb/s", conn_info.port, conn_info.speed);
/// info!(target: "connection_events", "Successfull connection, port: {}, speed: {}",
/// conn_info.port, conn_info.speed);
/// # }
/// ```
#[macro_export(local_inner_macros)]
macro_rules! info {
// info!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log")
// info!(target: "my_target", "a {} event", "log")
(target: $target:expr, $($arg:tt)+) => (log!(target: $target, $crate::Level::Info, $($arg)+));
// info!("a {} event", "log")
($($arg:tt)+) => (log!($crate::Level::Info, $($arg)+))
}
/// Logs a message at the debug level.
///
/// # Examples
///
/// ```edition2018
/// use log::debug;
///
/// # fn main() {
/// # struct Position { x: f32, y: f32 }
/// let pos = Position { x: 3.234, y: -1.223 };
///
/// debug!("New position: x: {}, y: {}", pos.x, pos.y);
/// debug!(target: "app_events", "New position: x: {}, y: {}", pos.x, pos.y);
/// # }
/// ```
#[macro_export(local_inner_macros)]
macro_rules! debug {
// debug!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log")
// debug!(target: "my_target", "a {} event", "log")
(target: $target:expr, $($arg:tt)+) => (log!(target: $target, $crate::Level::Debug, $($arg)+));
// debug!("a {} event", "log")
($($arg:tt)+) => (log!($crate::Level::Debug, $($arg)+))
}
/// Logs a message at the trace level.
///
/// # Examples
///
/// ```edition2018
/// use log::trace;
///
/// # fn main() {
/// # struct Position { x: f32, y: f32 }
/// let pos = Position { x: 3.234, y: -1.223 };
///
/// trace!("Position is: x: {}, y: {}", pos.x, pos.y);
/// trace!(target: "app_events", "x is {} and y is {}",
/// if pos.x >= 0.0 { "positive" } else { "negative" },
/// if pos.y >= 0.0 { "positive" } else { "negative" });
/// # }
/// ```
#[macro_export(local_inner_macros)]
macro_rules! trace {
// trace!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log")
// trace!(target: "my_target", "a {} event", "log")
(target: $target:expr, $($arg:tt)+) => (log!(target: $target, $crate::Level::Trace, $($arg)+));
// trace!("a {} event", "log")
($($arg:tt)+) => (log!($crate::Level::Trace, $($arg)+))
}
/// Determines if a message logged at the specified level in that module will
/// be logged.
///
/// This can be used to avoid expensive computation of log message arguments if
/// the message would be ignored anyway.
///
/// # Examples
///
/// ```edition2018
/// use log::Level::Debug;
/// use log::{debug, log_enabled};
///
/// # fn foo() {
/// if log_enabled!(Debug) {
/// let data = expensive_call();
/// debug!("expensive debug data: {} {}", data.x, data.y);
/// }
/// if log_enabled!(target: "Global", Debug) {
/// let data = expensive_call();
/// debug!(target: "Global", "expensive debug data: {} {}", data.x, data.y);
/// }
/// # }
/// # struct Data { x: u32, y: u32 }
/// # fn expensive_call() -> Data { Data { x: 0, y: 0 } }
/// # fn main() {}
/// ```
#[macro_export(local_inner_macros)]
macro_rules! log_enabled {
(target: $target:expr, $lvl:expr) => {{
let lvl = $lvl;
lvl <= $crate::STATIC_MAX_LEVEL
&& lvl <= $crate::max_level()
&& $crate::__private_api_enabled(lvl, $target)
}};
($lvl:expr) => {
log_enabled!(target: __log_module_path!(), $lvl)
};
}
// The log macro above cannot invoke format_args directly because it uses
// local_inner_macros. A format_args invocation there would resolve to
// $crate::format_args which does not exist. Instead invoke format_args here
// outside of local_inner_macros so that it resolves (probably) to
// core::format_args or std::format_args. Same for the several macros that
// follow.
//
// This is a workaround until we drop support for pre-1.30 compilers. At that
// point we can remove use of local_inner_macros, use $crate:: when invoking
// local macros, and invoke format_args directly.
#[doc(hidden)]
#[macro_export]
macro_rules! __log_format_args {
($($args:tt)*) => {
format_args!($($args)*)
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __log_module_path {
() => {
module_path!()
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __log_file {
() => {
file!()
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __log_line {
() => {
line!()
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __log_key {
// key1 = 42
($($args:ident)*) => {
stringify!($($args)*)
};
// "key1" = 42
($($args:expr)*) => {
$($args)*
};
}

View File

@ -1,400 +1,400 @@
#![cfg(feature = "serde")]
extern crate serde;
use self::serde::de::{
Deserialize, DeserializeSeed, Deserializer, EnumAccess, Error, Unexpected, VariantAccess,
Visitor,
};
use self::serde::ser::{Serialize, Serializer};
use {Level, LevelFilter, LOG_LEVEL_NAMES};
use std::fmt;
use std::str::{self, FromStr};
// The Deserialize impls are handwritten to be case insensitive using FromStr.
impl Serialize for Level {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
match *self {
Level::Error => serializer.serialize_unit_variant("Level", 0, "ERROR"),
Level::Warn => serializer.serialize_unit_variant("Level", 1, "WARN"),
Level::Info => serializer.serialize_unit_variant("Level", 2, "INFO"),
Level::Debug => serializer.serialize_unit_variant("Level", 3, "DEBUG"),
Level::Trace => serializer.serialize_unit_variant("Level", 4, "TRACE"),
}
}
}
impl<'de> Deserialize<'de> for Level {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct LevelIdentifier;
impl<'de> Visitor<'de> for LevelIdentifier {
type Value = Level;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("log level")
}
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
where
E: Error,
{
// Case insensitive.
FromStr::from_str(s).map_err(|_| Error::unknown_variant(s, &LOG_LEVEL_NAMES[1..]))
}
fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E>
where
E: Error,
{
let variant = str::from_utf8(value)
.map_err(|_| Error::invalid_value(Unexpected::Bytes(value), &self))?;
self.visit_str(variant)
}
fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
where
E: Error,
{
let variant = LOG_LEVEL_NAMES[1..]
.get(v as usize)
.ok_or_else(|| Error::invalid_value(Unexpected::Unsigned(v), &self))?;
self.visit_str(variant)
}
}
impl<'de> DeserializeSeed<'de> for LevelIdentifier {
type Value = Level;
fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
where
D: Deserializer<'de>,
{
deserializer.deserialize_identifier(LevelIdentifier)
}
}
struct LevelEnum;
impl<'de> Visitor<'de> for LevelEnum {
type Value = Level;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("log level")
}
fn visit_enum<A>(self, value: A) -> Result<Self::Value, A::Error>
where
A: EnumAccess<'de>,
{
let (level, variant) = value.variant_seed(LevelIdentifier)?;
// Every variant is a unit variant.
variant.unit_variant()?;
Ok(level)
}
}
deserializer.deserialize_enum("Level", &LOG_LEVEL_NAMES[1..], LevelEnum)
}
}
impl Serialize for LevelFilter {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
match *self {
LevelFilter::Off => serializer.serialize_unit_variant("LevelFilter", 0, "OFF"),
LevelFilter::Error => serializer.serialize_unit_variant("LevelFilter", 1, "ERROR"),
LevelFilter::Warn => serializer.serialize_unit_variant("LevelFilter", 2, "WARN"),
LevelFilter::Info => serializer.serialize_unit_variant("LevelFilter", 3, "INFO"),
LevelFilter::Debug => serializer.serialize_unit_variant("LevelFilter", 4, "DEBUG"),
LevelFilter::Trace => serializer.serialize_unit_variant("LevelFilter", 5, "TRACE"),
}
}
}
impl<'de> Deserialize<'de> for LevelFilter {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct LevelFilterIdentifier;
impl<'de> Visitor<'de> for LevelFilterIdentifier {
type Value = LevelFilter;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("log level filter")
}
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
where
E: Error,
{
// Case insensitive.
FromStr::from_str(s).map_err(|_| Error::unknown_variant(s, &LOG_LEVEL_NAMES))
}
fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E>
where
E: Error,
{
let variant = str::from_utf8(value)
.map_err(|_| Error::invalid_value(Unexpected::Bytes(value), &self))?;
self.visit_str(variant)
}
fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
where
E: Error,
{
let variant = LOG_LEVEL_NAMES
.get(v as usize)
.ok_or_else(|| Error::invalid_value(Unexpected::Unsigned(v), &self))?;
self.visit_str(variant)
}
}
impl<'de> DeserializeSeed<'de> for LevelFilterIdentifier {
type Value = LevelFilter;
fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
where
D: Deserializer<'de>,
{
deserializer.deserialize_identifier(LevelFilterIdentifier)
}
}
struct LevelFilterEnum;
impl<'de> Visitor<'de> for LevelFilterEnum {
type Value = LevelFilter;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("log level filter")
}
fn visit_enum<A>(self, value: A) -> Result<Self::Value, A::Error>
where
A: EnumAccess<'de>,
{
let (level_filter, variant) = value.variant_seed(LevelFilterIdentifier)?;
// Every variant is a unit variant.
variant.unit_variant()?;
Ok(level_filter)
}
}
deserializer.deserialize_enum("LevelFilter", &LOG_LEVEL_NAMES, LevelFilterEnum)
}
}
#[cfg(test)]
mod tests {
extern crate serde_test;
use self::serde_test::{assert_de_tokens, assert_de_tokens_error, assert_tokens, Token};
use {Level, LevelFilter};
fn level_token(variant: &'static str) -> Token {
Token::UnitVariant {
name: "Level",
variant: variant,
}
}
fn level_bytes_tokens(variant: &'static [u8]) -> [Token; 3] {
[
Token::Enum { name: "Level" },
Token::Bytes(variant),
Token::Unit,
]
}
fn level_variant_tokens(variant: u32) -> [Token; 3] {
[
Token::Enum { name: "Level" },
Token::U32(variant),
Token::Unit,
]
}
fn level_filter_token(variant: &'static str) -> Token {
Token::UnitVariant {
name: "LevelFilter",
variant: variant,
}
}
fn level_filter_bytes_tokens(variant: &'static [u8]) -> [Token; 3] {
[
Token::Enum {
name: "LevelFilter",
},
Token::Bytes(variant),
Token::Unit,
]
}
fn level_filter_variant_tokens(variant: u32) -> [Token; 3] {
[
Token::Enum {
name: "LevelFilter",
},
Token::U32(variant),
Token::Unit,
]
}
#[test]
fn test_level_ser_de() {
let cases = [
(Level::Error, [level_token("ERROR")]),
(Level::Warn, [level_token("WARN")]),
(Level::Info, [level_token("INFO")]),
(Level::Debug, [level_token("DEBUG")]),
(Level::Trace, [level_token("TRACE")]),
];
for &(s, expected) in &cases {
assert_tokens(&s, &expected);
}
}
#[test]
fn test_level_case_insensitive() {
let cases = [
(Level::Error, [level_token("error")]),
(Level::Warn, [level_token("warn")]),
(Level::Info, [level_token("info")]),
(Level::Debug, [level_token("debug")]),
(Level::Trace, [level_token("trace")]),
];
for &(s, expected) in &cases {
assert_de_tokens(&s, &expected);
}
}
#[test]
fn test_level_de_bytes() {
let cases = [
(Level::Error, level_bytes_tokens(b"ERROR")),
(Level::Warn, level_bytes_tokens(b"WARN")),
(Level::Info, level_bytes_tokens(b"INFO")),
(Level::Debug, level_bytes_tokens(b"DEBUG")),
(Level::Trace, level_bytes_tokens(b"TRACE")),
];
for &(value, tokens) in &cases {
assert_de_tokens(&value, &tokens);
}
}
#[test]
fn test_level_de_variant_index() {
let cases = [
(Level::Error, level_variant_tokens(0)),
(Level::Warn, level_variant_tokens(1)),
(Level::Info, level_variant_tokens(2)),
(Level::Debug, level_variant_tokens(3)),
(Level::Trace, level_variant_tokens(4)),
];
for &(value, tokens) in &cases {
assert_de_tokens(&value, &tokens);
}
}
#[test]
fn test_level_de_error() {
let msg = "unknown variant `errorx`, expected one of \
`ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`";
assert_de_tokens_error::<Level>(&[level_token("errorx")], msg);
}
#[test]
fn test_level_filter_ser_de() {
let cases = [
(LevelFilter::Off, [level_filter_token("OFF")]),
(LevelFilter::Error, [level_filter_token("ERROR")]),
(LevelFilter::Warn, [level_filter_token("WARN")]),
(LevelFilter::Info, [level_filter_token("INFO")]),
(LevelFilter::Debug, [level_filter_token("DEBUG")]),
(LevelFilter::Trace, [level_filter_token("TRACE")]),
];
for &(s, expected) in &cases {
assert_tokens(&s, &expected);
}
}
#[test]
fn test_level_filter_case_insensitive() {
let cases = [
(LevelFilter::Off, [level_filter_token("off")]),
(LevelFilter::Error, [level_filter_token("error")]),
(LevelFilter::Warn, [level_filter_token("warn")]),
(LevelFilter::Info, [level_filter_token("info")]),
(LevelFilter::Debug, [level_filter_token("debug")]),
(LevelFilter::Trace, [level_filter_token("trace")]),
];
for &(s, expected) in &cases {
assert_de_tokens(&s, &expected);
}
}
#[test]
fn test_level_filter_de_bytes() {
let cases = [
(LevelFilter::Off, level_filter_bytes_tokens(b"OFF")),
(LevelFilter::Error, level_filter_bytes_tokens(b"ERROR")),
(LevelFilter::Warn, level_filter_bytes_tokens(b"WARN")),
(LevelFilter::Info, level_filter_bytes_tokens(b"INFO")),
(LevelFilter::Debug, level_filter_bytes_tokens(b"DEBUG")),
(LevelFilter::Trace, level_filter_bytes_tokens(b"TRACE")),
];
for &(value, tokens) in &cases {
assert_de_tokens(&value, &tokens);
}
}
#[test]
fn test_level_filter_de_variant_index() {
let cases = [
(LevelFilter::Off, level_filter_variant_tokens(0)),
(LevelFilter::Error, level_filter_variant_tokens(1)),
(LevelFilter::Warn, level_filter_variant_tokens(2)),
(LevelFilter::Info, level_filter_variant_tokens(3)),
(LevelFilter::Debug, level_filter_variant_tokens(4)),
(LevelFilter::Trace, level_filter_variant_tokens(5)),
];
for &(value, tokens) in &cases {
assert_de_tokens(&value, &tokens);
}
}
#[test]
fn test_level_filter_de_error() {
let msg = "unknown variant `errorx`, expected one of \
`OFF`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`";
assert_de_tokens_error::<LevelFilter>(&[level_filter_token("errorx")], msg);
}
}
#![cfg(feature = "serde")]
extern crate serde;
use self::serde::de::{
Deserialize, DeserializeSeed, Deserializer, EnumAccess, Error, Unexpected, VariantAccess,
Visitor,
};
use self::serde::ser::{Serialize, Serializer};
use {Level, LevelFilter, LOG_LEVEL_NAMES};
use std::fmt;
use std::str::{self, FromStr};
// The Deserialize impls are handwritten to be case insensitive using FromStr.
impl Serialize for Level {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
match *self {
Level::Error => serializer.serialize_unit_variant("Level", 0, "ERROR"),
Level::Warn => serializer.serialize_unit_variant("Level", 1, "WARN"),
Level::Info => serializer.serialize_unit_variant("Level", 2, "INFO"),
Level::Debug => serializer.serialize_unit_variant("Level", 3, "DEBUG"),
Level::Trace => serializer.serialize_unit_variant("Level", 4, "TRACE"),
}
}
}
impl<'de> Deserialize<'de> for Level {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct LevelIdentifier;
impl<'de> Visitor<'de> for LevelIdentifier {
type Value = Level;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("log level")
}
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
where
E: Error,
{
// Case insensitive.
FromStr::from_str(s).map_err(|_| Error::unknown_variant(s, &LOG_LEVEL_NAMES[1..]))
}
fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E>
where
E: Error,
{
let variant = str::from_utf8(value)
.map_err(|_| Error::invalid_value(Unexpected::Bytes(value), &self))?;
self.visit_str(variant)
}
fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
where
E: Error,
{
let variant = LOG_LEVEL_NAMES[1..]
.get(v as usize)
.ok_or_else(|| Error::invalid_value(Unexpected::Unsigned(v), &self))?;
self.visit_str(variant)
}
}
impl<'de> DeserializeSeed<'de> for LevelIdentifier {
type Value = Level;
fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
where
D: Deserializer<'de>,
{
deserializer.deserialize_identifier(LevelIdentifier)
}
}
struct LevelEnum;
impl<'de> Visitor<'de> for LevelEnum {
type Value = Level;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("log level")
}
fn visit_enum<A>(self, value: A) -> Result<Self::Value, A::Error>
where
A: EnumAccess<'de>,
{
let (level, variant) = value.variant_seed(LevelIdentifier)?;
// Every variant is a unit variant.
variant.unit_variant()?;
Ok(level)
}
}
deserializer.deserialize_enum("Level", &LOG_LEVEL_NAMES[1..], LevelEnum)
}
}
impl Serialize for LevelFilter {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
match *self {
LevelFilter::Off => serializer.serialize_unit_variant("LevelFilter", 0, "OFF"),
LevelFilter::Error => serializer.serialize_unit_variant("LevelFilter", 1, "ERROR"),
LevelFilter::Warn => serializer.serialize_unit_variant("LevelFilter", 2, "WARN"),
LevelFilter::Info => serializer.serialize_unit_variant("LevelFilter", 3, "INFO"),
LevelFilter::Debug => serializer.serialize_unit_variant("LevelFilter", 4, "DEBUG"),
LevelFilter::Trace => serializer.serialize_unit_variant("LevelFilter", 5, "TRACE"),
}
}
}
impl<'de> Deserialize<'de> for LevelFilter {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct LevelFilterIdentifier;
impl<'de> Visitor<'de> for LevelFilterIdentifier {
type Value = LevelFilter;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("log level filter")
}
fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
where
E: Error,
{
// Case insensitive.
FromStr::from_str(s).map_err(|_| Error::unknown_variant(s, &LOG_LEVEL_NAMES))
}
fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E>
where
E: Error,
{
let variant = str::from_utf8(value)
.map_err(|_| Error::invalid_value(Unexpected::Bytes(value), &self))?;
self.visit_str(variant)
}
fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>
where
E: Error,
{
let variant = LOG_LEVEL_NAMES
.get(v as usize)
.ok_or_else(|| Error::invalid_value(Unexpected::Unsigned(v), &self))?;
self.visit_str(variant)
}
}
impl<'de> DeserializeSeed<'de> for LevelFilterIdentifier {
type Value = LevelFilter;
fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
where
D: Deserializer<'de>,
{
deserializer.deserialize_identifier(LevelFilterIdentifier)
}
}
struct LevelFilterEnum;
impl<'de> Visitor<'de> for LevelFilterEnum {
type Value = LevelFilter;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("log level filter")
}
fn visit_enum<A>(self, value: A) -> Result<Self::Value, A::Error>
where
A: EnumAccess<'de>,
{
let (level_filter, variant) = value.variant_seed(LevelFilterIdentifier)?;
// Every variant is a unit variant.
variant.unit_variant()?;
Ok(level_filter)
}
}
deserializer.deserialize_enum("LevelFilter", &LOG_LEVEL_NAMES, LevelFilterEnum)
}
}
#[cfg(test)]
mod tests {
extern crate serde_test;
use self::serde_test::{assert_de_tokens, assert_de_tokens_error, assert_tokens, Token};
use {Level, LevelFilter};
fn level_token(variant: &'static str) -> Token {
Token::UnitVariant {
name: "Level",
variant: variant,
}
}
fn level_bytes_tokens(variant: &'static [u8]) -> [Token; 3] {
[
Token::Enum { name: "Level" },
Token::Bytes(variant),
Token::Unit,
]
}
fn level_variant_tokens(variant: u32) -> [Token; 3] {
[
Token::Enum { name: "Level" },
Token::U32(variant),
Token::Unit,
]
}
fn level_filter_token(variant: &'static str) -> Token {
Token::UnitVariant {
name: "LevelFilter",
variant: variant,
}
}
fn level_filter_bytes_tokens(variant: &'static [u8]) -> [Token; 3] {
[
Token::Enum {
name: "LevelFilter",
},
Token::Bytes(variant),
Token::Unit,
]
}
fn level_filter_variant_tokens(variant: u32) -> [Token; 3] {
[
Token::Enum {
name: "LevelFilter",
},
Token::U32(variant),
Token::Unit,
]
}
#[test]
fn test_level_ser_de() {
let cases = [
(Level::Error, [level_token("ERROR")]),
(Level::Warn, [level_token("WARN")]),
(Level::Info, [level_token("INFO")]),
(Level::Debug, [level_token("DEBUG")]),
(Level::Trace, [level_token("TRACE")]),
];
for &(s, expected) in &cases {
assert_tokens(&s, &expected);
}
}
#[test]
fn test_level_case_insensitive() {
let cases = [
(Level::Error, [level_token("error")]),
(Level::Warn, [level_token("warn")]),
(Level::Info, [level_token("info")]),
(Level::Debug, [level_token("debug")]),
(Level::Trace, [level_token("trace")]),
];
for &(s, expected) in &cases {
assert_de_tokens(&s, &expected);
}
}
#[test]
fn test_level_de_bytes() {
let cases = [
(Level::Error, level_bytes_tokens(b"ERROR")),
(Level::Warn, level_bytes_tokens(b"WARN")),
(Level::Info, level_bytes_tokens(b"INFO")),
(Level::Debug, level_bytes_tokens(b"DEBUG")),
(Level::Trace, level_bytes_tokens(b"TRACE")),
];
for &(value, tokens) in &cases {
assert_de_tokens(&value, &tokens);
}
}
#[test]
fn test_level_de_variant_index() {
let cases = [
(Level::Error, level_variant_tokens(0)),
(Level::Warn, level_variant_tokens(1)),
(Level::Info, level_variant_tokens(2)),
(Level::Debug, level_variant_tokens(3)),
(Level::Trace, level_variant_tokens(4)),
];
for &(value, tokens) in &cases {
assert_de_tokens(&value, &tokens);
}
}
#[test]
fn test_level_de_error() {
let msg = "unknown variant `errorx`, expected one of \
`ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`";
assert_de_tokens_error::<Level>(&[level_token("errorx")], msg);
}
#[test]
fn test_level_filter_ser_de() {
let cases = [
(LevelFilter::Off, [level_filter_token("OFF")]),
(LevelFilter::Error, [level_filter_token("ERROR")]),
(LevelFilter::Warn, [level_filter_token("WARN")]),
(LevelFilter::Info, [level_filter_token("INFO")]),
(LevelFilter::Debug, [level_filter_token("DEBUG")]),
(LevelFilter::Trace, [level_filter_token("TRACE")]),
];
for &(s, expected) in &cases {
assert_tokens(&s, &expected);
}
}
#[test]
fn test_level_filter_case_insensitive() {
let cases = [
(LevelFilter::Off, [level_filter_token("off")]),
(LevelFilter::Error, [level_filter_token("error")]),
(LevelFilter::Warn, [level_filter_token("warn")]),
(LevelFilter::Info, [level_filter_token("info")]),
(LevelFilter::Debug, [level_filter_token("debug")]),
(LevelFilter::Trace, [level_filter_token("trace")]),
];
for &(s, expected) in &cases {
assert_de_tokens(&s, &expected);
}
}
#[test]
fn test_level_filter_de_bytes() {
let cases = [
(LevelFilter::Off, level_filter_bytes_tokens(b"OFF")),
(LevelFilter::Error, level_filter_bytes_tokens(b"ERROR")),
(LevelFilter::Warn, level_filter_bytes_tokens(b"WARN")),
(LevelFilter::Info, level_filter_bytes_tokens(b"INFO")),
(LevelFilter::Debug, level_filter_bytes_tokens(b"DEBUG")),
(LevelFilter::Trace, level_filter_bytes_tokens(b"TRACE")),
];
for &(value, tokens) in &cases {
assert_de_tokens(&value, &tokens);
}
}
#[test]
fn test_level_filter_de_variant_index() {
let cases = [
(LevelFilter::Off, level_filter_variant_tokens(0)),
(LevelFilter::Error, level_filter_variant_tokens(1)),
(LevelFilter::Warn, level_filter_variant_tokens(2)),
(LevelFilter::Info, level_filter_variant_tokens(3)),
(LevelFilter::Debug, level_filter_variant_tokens(4)),
(LevelFilter::Trace, level_filter_variant_tokens(5)),
];
for &(value, tokens) in &cases {
assert_de_tokens(&value, &tokens);
}
}
#[test]
fn test_level_filter_de_error() {
let msg = "unknown variant `errorx`, expected one of \
`OFF`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`";
assert_de_tokens_error::<LevelFilter>(&[level_filter_token("errorx")], msg);
}
}

View File

@ -1 +1 @@
[assign]
[assign]

View File

@ -1,191 +1,191 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2017 Aaron Power
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2017 Aaron Power
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,26 +1,26 @@
Copyright (c) 2017 Aaron Power
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.
Copyright (c) 2017 Aaron Power
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.

View File

@ -1,20 +1,20 @@
# remove_dir_all
[![Latest Version](https://img.shields.io/crates/v/remove_dir_all.svg)](https://crates.io/crates/remove_dir_all)
[![Docs](https://docs.rs/remove_dir_all/badge.svg)](https://docs.rs/remove_dir_all)
[![License](https://img.shields.io/github/license/XAMPPRocky/remove_dir_all.svg)](https://github.com/XAMPPRocky/remove_dir_all)
## Description
A reliable implementation of `remove_dir_all` for Windows. For Unix systems
re-exports `std::fs::remove_dir_all`.
```rust,no_run
extern crate remove_dir_all;
use remove_dir_all::*;
fn main() {
remove_dir_all("./temp/").unwrap();
}
```
# remove_dir_all
[![Latest Version](https://img.shields.io/crates/v/remove_dir_all.svg)](https://crates.io/crates/remove_dir_all)
[![Docs](https://docs.rs/remove_dir_all/badge.svg)](https://docs.rs/remove_dir_all)
[![License](https://img.shields.io/github/license/XAMPPRocky/remove_dir_all.svg)](https://github.com/XAMPPRocky/remove_dir_all)
## Description
A reliable implementation of `remove_dir_all` for Windows. For Unix systems
re-exports `std::fs::remove_dir_all`.
```rust,no_run
extern crate remove_dir_all;
use remove_dir_all::*;
fn main() {
remove_dir_all("./temp/").unwrap();
}
```

View File

@ -1,278 +1,278 @@
use std::ffi::OsString;
use std::fs::{self, File, OpenOptions};
use std::os::windows::prelude::*;
use std::path::{Path, PathBuf};
use std::{io, ptr};
use winapi::shared::minwindef::*;
use winapi::shared::winerror::*;
use winapi::um::errhandlingapi::*;
use winapi::um::fileapi::*;
use winapi::um::minwinbase::*;
use winapi::um::winbase::*;
use winapi::um::winnt::*;
pub const VOLUME_NAME_DOS: DWORD = 0x0;
struct RmdirContext<'a> {
base_dir: &'a Path,
readonly: bool,
counter: u64,
}
/// Reliably removes a directory and all of its children.
///
/// ```rust
/// extern crate remove_dir_all;
///
/// use std::fs;
/// use remove_dir_all::*;
///
/// fn main() {
/// fs::create_dir("./temp/").unwrap();
/// remove_dir_all("./temp/").unwrap();
/// }
/// ```
pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
// On Windows it is not enough to just recursively remove the contents of a
// directory and then the directory itself. Deleting does not happen
// instantaneously, but is scheduled.
// To work around this, we move the file or directory to some `base_dir`
// right before deletion to avoid races.
//
// As `base_dir` we choose the parent dir of the directory we want to
// remove. We very probably have permission to create files here, as we
// already need write permission in this dir to delete the directory. And it
// should be on the same volume.
//
// To handle files with names like `CON` and `morse .. .`, and when a
// directory structure is so deep it needs long path names the path is first
// converted to a `//?/`-path with `get_path()`.
//
// To make sure we don't leave a moved file laying around if the process
// crashes before we can delete the file, we do all operations on an file
// handle. By opening a file with `FILE_FLAG_DELETE_ON_CLOSE` Windows will
// always delete the file when the handle closes.
//
// All files are renamed to be in the `base_dir`, and have their name
// changed to "rm-<counter>". After every rename the counter is increased.
// Rename should not overwrite possibly existing files in the base dir. So
// if it fails with `AlreadyExists`, we just increase the counter and try
// again.
//
// For read-only files and directories we first have to remove the read-only
// attribute before we can move or delete them. This also removes the
// attribute from possible hardlinks to the file, so just before closing we
// restore the read-only attribute.
//
// If 'path' points to a directory symlink or junction we should not
// recursively remove the target of the link, but only the link itself.
//
// Moving and deleting is guaranteed to succeed if we are able to open the
// file with `DELETE` permission. If others have the file open we only have
// `DELETE` permission if they have specified `FILE_SHARE_DELETE`. We can
// also delete the file now, but it will not disappear until all others have
// closed the file. But no-one can open the file after we have flagged it
// for deletion.
// Open the path once to get the canonical path, file type and attributes.
let (path, metadata) = {
let path = path.as_ref();
let mut opts = OpenOptions::new();
opts.access_mode(FILE_READ_ATTRIBUTES);
opts.custom_flags(FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT);
let file = opts.open(path)?;
(get_path(&file)?, path.metadata()?)
};
let mut ctx = RmdirContext {
base_dir: match path.parent() {
Some(dir) => dir,
None => {
return Err(io::Error::new(
io::ErrorKind::PermissionDenied,
"Can't delete root directory",
))
}
},
readonly: metadata.permissions().readonly(),
counter: 0,
};
let filetype = metadata.file_type();
if filetype.is_dir() {
if !filetype.is_symlink() {
remove_dir_all_recursive(path.as_ref(), &mut ctx)
} else {
remove_item(path.as_ref(), &mut ctx)
}
} else {
Err(io::Error::new(
io::ErrorKind::PermissionDenied,
"Not a directory",
))
}
}
fn remove_item(path: &Path, ctx: &mut RmdirContext) -> io::Result<()> {
if ctx.readonly {
// remove read-only permision
let mut permissions = path.metadata()?.permissions();
permissions.set_readonly(false);
fs::set_permissions(path, permissions)?;
}
let mut opts = OpenOptions::new();
opts.access_mode(DELETE);
opts.custom_flags(
FILE_FLAG_BACKUP_SEMANTICS | // delete directory
FILE_FLAG_OPEN_REPARSE_POINT | // delete symlink
FILE_FLAG_DELETE_ON_CLOSE,
);
let file = opts.open(path)?;
move_item(&file, ctx)?;
if ctx.readonly {
// restore read-only flag just in case there are other hard links
match fs::metadata(&path) {
Ok(metadata) => {
let mut perm = metadata.permissions();
perm.set_readonly(true);
fs::set_permissions(&path, perm)?;
}
Err(ref err) if err.kind() == io::ErrorKind::NotFound => {}
err => return err.map(|_| ()),
}
}
Ok(())
}
fn move_item(file: &File, ctx: &mut RmdirContext) -> io::Result<()> {
let mut tmpname = ctx.base_dir.join(format! {"rm-{}", ctx.counter});
ctx.counter += 1;
// Try to rename the file. If it already exists, just retry with an other
// filename.
while let Err(err) = rename(file, &tmpname, false) {
if err.kind() != io::ErrorKind::AlreadyExists {
return Err(err);
};
tmpname = ctx.base_dir.join(format!("rm-{}", ctx.counter));
ctx.counter += 1;
}
Ok(())
}
fn rename(file: &File, new: &Path, replace: bool) -> io::Result<()> {
// &self must be opened with DELETE permission
use std::iter;
#[cfg(target_pointer_width = "32")]
const STRUCT_SIZE: usize = 12;
#[cfg(target_pointer_width = "64")]
const STRUCT_SIZE: usize = 20;
// FIXME: check for internal NULs in 'new'
let mut data: Vec<u16> = iter::repeat(0u16)
.take(STRUCT_SIZE / 2)
.chain(new.as_os_str().encode_wide())
.collect();
data.push(0);
let size = data.len() * 2;
unsafe {
// Thanks to alignment guarantees on Windows this works
// (8 for 32-bit and 16 for 64-bit)
let info = data.as_mut_ptr() as *mut FILE_RENAME_INFO;
// The type of ReplaceIfExists is BOOL, but it actually expects a
// BOOLEAN. This means true is -1, not c::TRUE.
(*info).ReplaceIfExists = if replace { -1 } else { FALSE };
(*info).RootDirectory = ptr::null_mut();
(*info).FileNameLength = (size - STRUCT_SIZE) as DWORD;
let result = SetFileInformationByHandle(
file.as_raw_handle(),
FileRenameInfo,
data.as_mut_ptr() as *mut _ as *mut _,
size as DWORD,
);
if result == 0 {
Err(io::Error::last_os_error())
} else {
Ok(())
}
}
}
fn get_path(f: &File) -> io::Result<PathBuf> {
fill_utf16_buf(
|buf, sz| unsafe { GetFinalPathNameByHandleW(f.as_raw_handle(), buf, sz, VOLUME_NAME_DOS) },
|buf| PathBuf::from(OsString::from_wide(buf)),
)
}
fn remove_dir_all_recursive(path: &Path, ctx: &mut RmdirContext) -> io::Result<()> {
let dir_readonly = ctx.readonly;
for child in fs::read_dir(path)? {
let child = child?;
let child_type = child.file_type()?;
ctx.readonly = child.metadata()?.permissions().readonly();
if child_type.is_dir() {
remove_dir_all_recursive(&child.path(), ctx)?;
} else {
remove_item(&child.path().as_ref(), ctx)?;
}
}
ctx.readonly = dir_readonly;
remove_item(path, ctx)
}
fn fill_utf16_buf<F1, F2, T>(mut f1: F1, f2: F2) -> io::Result<T>
where
F1: FnMut(*mut u16, DWORD) -> DWORD,
F2: FnOnce(&[u16]) -> T,
{
// Start off with a stack buf but then spill over to the heap if we end up
// needing more space.
let mut stack_buf = [0u16; 512];
let mut heap_buf = Vec::new();
unsafe {
let mut n = stack_buf.len();
loop {
let buf = if n <= stack_buf.len() {
&mut stack_buf[..]
} else {
let extra = n - heap_buf.len();
heap_buf.reserve(extra);
heap_buf.set_len(n);
&mut heap_buf[..]
};
// This function is typically called on windows API functions which
// will return the correct length of the string, but these functions
// also return the `0` on error. In some cases, however, the
// returned "correct length" may actually be 0!
//
// To handle this case we call `SetLastError` to reset it to 0 and
// then check it again if we get the "0 error value". If the "last
// error" is still 0 then we interpret it as a 0 length buffer and
// not an actual error.
SetLastError(0);
let k = match f1(buf.as_mut_ptr(), n as DWORD) {
0 if GetLastError() == 0 => 0,
0 => return Err(io::Error::last_os_error()),
n => n,
} as usize;
if k == n && GetLastError() == ERROR_INSUFFICIENT_BUFFER {
n *= 2;
} else if k >= n {
n = k;
} else {
return Ok(f2(&buf[..k]));
}
}
}
}
use std::ffi::OsString;
use std::fs::{self, File, OpenOptions};
use std::os::windows::prelude::*;
use std::path::{Path, PathBuf};
use std::{io, ptr};
use winapi::shared::minwindef::*;
use winapi::shared::winerror::*;
use winapi::um::errhandlingapi::*;
use winapi::um::fileapi::*;
use winapi::um::minwinbase::*;
use winapi::um::winbase::*;
use winapi::um::winnt::*;
pub const VOLUME_NAME_DOS: DWORD = 0x0;
struct RmdirContext<'a> {
base_dir: &'a Path,
readonly: bool,
counter: u64,
}
/// Reliably removes a directory and all of its children.
///
/// ```rust
/// extern crate remove_dir_all;
///
/// use std::fs;
/// use remove_dir_all::*;
///
/// fn main() {
/// fs::create_dir("./temp/").unwrap();
/// remove_dir_all("./temp/").unwrap();
/// }
/// ```
pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
// On Windows it is not enough to just recursively remove the contents of a
// directory and then the directory itself. Deleting does not happen
// instantaneously, but is scheduled.
// To work around this, we move the file or directory to some `base_dir`
// right before deletion to avoid races.
//
// As `base_dir` we choose the parent dir of the directory we want to
// remove. We very probably have permission to create files here, as we
// already need write permission in this dir to delete the directory. And it
// should be on the same volume.
//
// To handle files with names like `CON` and `morse .. .`, and when a
// directory structure is so deep it needs long path names the path is first
// converted to a `//?/`-path with `get_path()`.
//
// To make sure we don't leave a moved file laying around if the process
// crashes before we can delete the file, we do all operations on an file
// handle. By opening a file with `FILE_FLAG_DELETE_ON_CLOSE` Windows will
// always delete the file when the handle closes.
//
// All files are renamed to be in the `base_dir`, and have their name
// changed to "rm-<counter>". After every rename the counter is increased.
// Rename should not overwrite possibly existing files in the base dir. So
// if it fails with `AlreadyExists`, we just increase the counter and try
// again.
//
// For read-only files and directories we first have to remove the read-only
// attribute before we can move or delete them. This also removes the
// attribute from possible hardlinks to the file, so just before closing we
// restore the read-only attribute.
//
// If 'path' points to a directory symlink or junction we should not
// recursively remove the target of the link, but only the link itself.
//
// Moving and deleting is guaranteed to succeed if we are able to open the
// file with `DELETE` permission. If others have the file open we only have
// `DELETE` permission if they have specified `FILE_SHARE_DELETE`. We can
// also delete the file now, but it will not disappear until all others have
// closed the file. But no-one can open the file after we have flagged it
// for deletion.
// Open the path once to get the canonical path, file type and attributes.
let (path, metadata) = {
let path = path.as_ref();
let mut opts = OpenOptions::new();
opts.access_mode(FILE_READ_ATTRIBUTES);
opts.custom_flags(FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT);
let file = opts.open(path)?;
(get_path(&file)?, path.metadata()?)
};
let mut ctx = RmdirContext {
base_dir: match path.parent() {
Some(dir) => dir,
None => {
return Err(io::Error::new(
io::ErrorKind::PermissionDenied,
"Can't delete root directory",
))
}
},
readonly: metadata.permissions().readonly(),
counter: 0,
};
let filetype = metadata.file_type();
if filetype.is_dir() {
if !filetype.is_symlink() {
remove_dir_all_recursive(path.as_ref(), &mut ctx)
} else {
remove_item(path.as_ref(), &mut ctx)
}
} else {
Err(io::Error::new(
io::ErrorKind::PermissionDenied,
"Not a directory",
))
}
}
fn remove_item(path: &Path, ctx: &mut RmdirContext) -> io::Result<()> {
if ctx.readonly {
// remove read-only permision
let mut permissions = path.metadata()?.permissions();
permissions.set_readonly(false);
fs::set_permissions(path, permissions)?;
}
let mut opts = OpenOptions::new();
opts.access_mode(DELETE);
opts.custom_flags(
FILE_FLAG_BACKUP_SEMANTICS | // delete directory
FILE_FLAG_OPEN_REPARSE_POINT | // delete symlink
FILE_FLAG_DELETE_ON_CLOSE,
);
let file = opts.open(path)?;
move_item(&file, ctx)?;
if ctx.readonly {
// restore read-only flag just in case there are other hard links
match fs::metadata(&path) {
Ok(metadata) => {
let mut perm = metadata.permissions();
perm.set_readonly(true);
fs::set_permissions(&path, perm)?;
}
Err(ref err) if err.kind() == io::ErrorKind::NotFound => {}
err => return err.map(|_| ()),
}
}
Ok(())
}
fn move_item(file: &File, ctx: &mut RmdirContext) -> io::Result<()> {
let mut tmpname = ctx.base_dir.join(format! {"rm-{}", ctx.counter});
ctx.counter += 1;
// Try to rename the file. If it already exists, just retry with an other
// filename.
while let Err(err) = rename(file, &tmpname, false) {
if err.kind() != io::ErrorKind::AlreadyExists {
return Err(err);
};
tmpname = ctx.base_dir.join(format!("rm-{}", ctx.counter));
ctx.counter += 1;
}
Ok(())
}
fn rename(file: &File, new: &Path, replace: bool) -> io::Result<()> {
// &self must be opened with DELETE permission
use std::iter;
#[cfg(target_pointer_width = "32")]
const STRUCT_SIZE: usize = 12;
#[cfg(target_pointer_width = "64")]
const STRUCT_SIZE: usize = 20;
// FIXME: check for internal NULs in 'new'
let mut data: Vec<u16> = iter::repeat(0u16)
.take(STRUCT_SIZE / 2)
.chain(new.as_os_str().encode_wide())
.collect();
data.push(0);
let size = data.len() * 2;
unsafe {
// Thanks to alignment guarantees on Windows this works
// (8 for 32-bit and 16 for 64-bit)
let info = data.as_mut_ptr() as *mut FILE_RENAME_INFO;
// The type of ReplaceIfExists is BOOL, but it actually expects a
// BOOLEAN. This means true is -1, not c::TRUE.
(*info).ReplaceIfExists = if replace { -1 } else { FALSE };
(*info).RootDirectory = ptr::null_mut();
(*info).FileNameLength = (size - STRUCT_SIZE) as DWORD;
let result = SetFileInformationByHandle(
file.as_raw_handle(),
FileRenameInfo,
data.as_mut_ptr() as *mut _ as *mut _,
size as DWORD,
);
if result == 0 {
Err(io::Error::last_os_error())
} else {
Ok(())
}
}
}
fn get_path(f: &File) -> io::Result<PathBuf> {
fill_utf16_buf(
|buf, sz| unsafe { GetFinalPathNameByHandleW(f.as_raw_handle(), buf, sz, VOLUME_NAME_DOS) },
|buf| PathBuf::from(OsString::from_wide(buf)),
)
}
fn remove_dir_all_recursive(path: &Path, ctx: &mut RmdirContext) -> io::Result<()> {
let dir_readonly = ctx.readonly;
for child in fs::read_dir(path)? {
let child = child?;
let child_type = child.file_type()?;
ctx.readonly = child.metadata()?.permissions().readonly();
if child_type.is_dir() {
remove_dir_all_recursive(&child.path(), ctx)?;
} else {
remove_item(&child.path().as_ref(), ctx)?;
}
}
ctx.readonly = dir_readonly;
remove_item(path, ctx)
}
fn fill_utf16_buf<F1, F2, T>(mut f1: F1, f2: F2) -> io::Result<T>
where
F1: FnMut(*mut u16, DWORD) -> DWORD,
F2: FnOnce(&[u16]) -> T,
{
// Start off with a stack buf but then spill over to the heap if we end up
// needing more space.
let mut stack_buf = [0u16; 512];
let mut heap_buf = Vec::new();
unsafe {
let mut n = stack_buf.len();
loop {
let buf = if n <= stack_buf.len() {
&mut stack_buf[..]
} else {
let extra = n - heap_buf.len();
heap_buf.reserve(extra);
heap_buf.set_len(n);
&mut heap_buf[..]
};
// This function is typically called on windows API functions which
// will return the correct length of the string, but these functions
// also return the `0` on error. In some cases, however, the
// returned "correct length" may actually be 0!
//
// To handle this case we call `SetLastError` to reset it to 0 and
// then check it again if we get the "0 error value". If the "last
// error" is still 0 then we interpret it as a 0 length buffer and
// not an actual error.
SetLastError(0);
let k = match f1(buf.as_mut_ptr(), n as DWORD) {
0 if GetLastError() == 0 => 0,
0 => return Err(io::Error::last_os_error()),
n => n,
} as usize;
if k == n && GetLastError() == ERROR_INSUFFICIENT_BUFFER {
n *= 2;
} else if k >= n {
n = k;
} else {
return Ok(f2(&buf[..k]));
}
}
}
}

View File

@ -1,26 +1,26 @@
//! Reliably remove a directory and all of its children.
//!
//! This library provides a reliable implementation of `remove_dir_all` for Windows.
//! For Unix systems, it re-exports `std::fs::remove_dir_all`.
#![deny(missing_debug_implementations)]
#![deny(missing_docs)]
#[cfg(windows)]
extern crate winapi;
#[cfg(doctest)]
#[macro_use]
extern crate doc_comment;
#[cfg(doctest)]
doctest!("../README.md");
#[cfg(windows)]
mod fs;
#[cfg(windows)]
pub use self::fs::remove_dir_all;
#[cfg(not(windows))]
pub use std::fs::remove_dir_all;
//! Reliably remove a directory and all of its children.
//!
//! This library provides a reliable implementation of `remove_dir_all` for Windows.
//! For Unix systems, it re-exports `std::fs::remove_dir_all`.
#![deny(missing_debug_implementations)]
#![deny(missing_docs)]
#[cfg(windows)]
extern crate winapi;
#[cfg(doctest)]
#[macro_use]
extern crate doc_comment;
#[cfg(doctest)]
doctest!("../README.md");
#[cfg(windows)]
mod fs;
#[cfg(windows)]
pub use self::fs::remove_dir_all;
#[cfg(not(windows))]
pub use std::fs::remove_dir_all;

File diff suppressed because one or more lines are too long

View File

@ -1,309 +1,309 @@
# CAVS 11.1
# "SHA-1 Monte" information for "sha_values"
# SHA tests are configured for BYTE oriented implementations
# Generated on Wed May 11 17:26:02 2011
[L = 20]
Seed = dd4df644eaf3d85bace2b21accaa22b28821f5cd
COUNT = 0
MD = 11f5c38b4479d4ad55cb69fadf62de0b036d5163
COUNT = 1
MD = 5c26de848c21586bec36995809cb02d3677423d9
COUNT = 2
MD = 453b5fcf263d01c891d7897d4013990f7c1fb0ab
COUNT = 3
MD = 36d0273ae363f992bbc313aa4ff602e95c207be3
COUNT = 4
MD = d1c65e9ac55727fbf30eaf5f00cc22b9bab81a2c
COUNT = 5
MD = 2c477cd77e5749da7fc4e5ca7eed77166e8ceae6
COUNT = 6
MD = 60b11211137f46863501a32a435976eabd4532f3
COUNT = 7
MD = 0894f4f012a1e5344044e0ecfa6f078382064602
COUNT = 8
MD = 06b6222855cae9bed77e9e3050d164a98286ea5f
COUNT = 9
MD = e2872694d3d23a68a24419c35bd9ac9006248a8f
COUNT = 10
MD = ea43595eb1cff3a7e045c5868d0775b4409b14a3
COUNT = 11
MD = 05a9e94fdc792a61aa60bcd37592acee1f983280
COUNT = 12
MD = 7d11aa9413cd89a387a5c0f9aa5ce541be2aa6e8
COUNT = 13
MD = 37297d053aaa4a845cc9ce0c0165644ab8d0e00b
COUNT = 14
MD = d9dcde396d69748c1fe357f8b662a27ce89082c8
COUNT = 15
MD = 737a484499b6858b14e656c328979e8aa56b0a43
COUNT = 16
MD = 4e9c8b3bce910432ac2ad17d51e6b9ec4f92c1ad
COUNT = 17
MD = 62325b9a7cebcc6da3bfe781d84eb53a6eb7b019
COUNT = 18
MD = 4710670e071609d470f7d628d8ea978dfb9234ac
COUNT = 19
MD = 23baee80eee052f3263ac26dd12ea6504a5bd234
COUNT = 20
MD = 9451efb9c9586a403747acfa3ec74d359bb9d7ff
COUNT = 21
MD = 37e9d7c81b79f090c8e05848050936c64a1bd662
COUNT = 22
MD = a6489ff37141f7a86dd978f685fdd4789d1993dc
COUNT = 23
MD = 39650d32501dfcee212d0de10af9db47e4e5af65
COUNT = 24
MD = cd4ea3474e046b281da5a4bf69fd873ef8d568d6
COUNT = 25
MD = 0d7b518c07c6da877eee35301a99c7563f1840df
COUNT = 26
MD = 68a70ae466532f7f61af138889c0d3f9670f3590
COUNT = 27
MD = c0222aae5fd2b9eff143ac93c4493abe5c8806af
COUNT = 28
MD = d2efc5aa0b29db15f3e5de82aaa0a8ce888ffb2f
COUNT = 29
MD = eec4f55d02c627dcee36b5b5606603bdc9a94a26
COUNT = 30
MD = 0e706fb1a1fa26aab74efcef57ab6a49c07ca7bd
COUNT = 31
MD = 2ea392ca8043686424f7e9500edfb9e9297943f7
COUNT = 32
MD = 74737ef257b32a4cb9428c866b65bee62ccbe653
COUNT = 33
MD = df3e86e49a0429fa81f553b04b9fc003510e9a51
COUNT = 34
MD = 79c3049944fbf8b80dadadc7f5174e5cfdf996de
COUNT = 35
MD = f25e2eca4cfb6da8e8b7b62f581672fab80754fa
COUNT = 36
MD = 76509239d9fd6c6f050c0d9b3777b5645e4d4c70
COUNT = 37
MD = cf4bb3e1f330c862e239d9b010bd842f302bd227
COUNT = 38
MD = 4eeac7ab2ac9e4c81ed1a93a300b2af75beddb08
COUNT = 39
MD = 46443ba72a64fff4b5252fbac9ef93c2949f8585
COUNT = 40
MD = 5e9c42482343a54aadb11ab00c2e00cbe25ec91a
COUNT = 41
MD = 93acee1977128f2a4218678b32e2844f23eb526b
COUNT = 42
MD = 226065d299b2d6c582d386897b93f2adf14de00b
COUNT = 43
MD = 672fed0d90c21d4ec0111a7284bcf1bbd72af9bd
COUNT = 44
MD = 90d642f12f28cb3dad7daad84cf0f94ded1137ae
COUNT = 45
MD = 4a2815b58ffc858e5e7e9e6106765458d2af4ec3
COUNT = 46
MD = 29fa3679032421b78b7a08c54766c1592f6739c1
COUNT = 47
MD = 19f4e30393eb66c6e200744fa8999d224e6df173
COUNT = 48
MD = 30650026be77212088ab50438e04b4b8e3761977
COUNT = 49
MD = 993d0e135bcd598fa673c6f19251bcbde18b7b34
COUNT = 50
MD = c9eaf20b473219a70efe85940620426c6ff6f4a4
COUNT = 51
MD = 6325d0b83c308bd42854ce69446e85ba36348d7d
COUNT = 52
MD = 2fb354f8a68030efb747f78812060a9c05e92164
COUNT = 53
MD = a7e33bd16f770c17e8818ad5a5fc4fee673eae56
COUNT = 54
MD = ff23e7105bc9f4dad0fb9c6519d1eae16439a5d6
COUNT = 55
MD = a31aca821e163213cd2ae84cf56c1134daa4a621
COUNT = 56
MD = 94ab9cfd4cf9bf2e4409dbcdc9ef2c8b611cc69d
COUNT = 57
MD = c0194064ce48dde771b7871efa86a4a6e87eec76
COUNT = 58
MD = f1a9065e3e7f98753c6f833f5ffe74133f6b887f
COUNT = 59
MD = b8b3cd6ca1d5b5610e43212f8df75211aaddcf96
COUNT = 60
MD = 33c3a8d739cc2f83be597aa11c43e2ad6f0d2436
COUNT = 61
MD = 4f5c67e5110f3663b7aa88759dbba6fa82f2d705
COUNT = 62
MD = b1ebc87c7b2b8fe73e7a882d3f4f0492946e0d7c
COUNT = 63
MD = 01566616fe4a8c7cf22f21031ac6ea7fb7ce15db
COUNT = 64
MD = 5650f3517a393792781d23b4c9d360bf8bd31d65
COUNT = 65
MD = a4fdbd24cb4a328b898b804b103caa98baedd3fa
COUNT = 66
MD = 0cf01eecec4b85aa39f40aa9b4dce208d68eb17b
COUNT = 67
MD = ae9ac147bab7c10609abe6e931a5ab087a41dc5a
COUNT = 68
MD = c0328145ce63fb0aceeb414e791d2be92009b1ec
COUNT = 69
MD = 60343e5fb7eee00d31ea507b820ddbb7ef405dc7
COUNT = 70
MD = e0b97cd9149ff9955b6a35b3a79ecb3bdbd2a5a5
COUNT = 71
MD = 4e4fdcd382ae0f3f4fbda5fd934eee0d6ad37df5
COUNT = 72
MD = 9d97dd237d193482cf3ab862a38843762e69077f
COUNT = 73
MD = 2bc927d17ff2f8a844f6f36a944a64d73d431192
COUNT = 74
MD = b91200306b769aab18e5e411b5bd5e7bce1cc80e
COUNT = 75
MD = c47493a666085e1b7a75618761a80c402f46546d
COUNT = 76
MD = 31355869b80ff84fac239db694ada07d3be26b15
COUNT = 77
MD = 1a2022f6330bf96f025cb7d8f0201a7d70b3b58e
COUNT = 78
MD = 0f60d7c5ad49efce939c3a27da9973f7f1747848
COUNT = 79
MD = ceada087801616fc6c08cfa469658f3dc5239ca7
COUNT = 80
MD = 4ad0cf9181122b06df714397bd5366aa90bfc9fa
COUNT = 81
MD = ac6404e6b9d5c0fa17fa77fd39850f22b76ecd83
COUNT = 82
MD = f0658218adffb9ee9328577854b6387393957a3a
COUNT = 83
MD = 6fe9992747897389957b9a91467a4ec983829ab6
COUNT = 84
MD = 74320b3ddde6dbfbdad3ad29a7695f5a275b2105
COUNT = 85
MD = 2009ea5d6452f51d12477740e374e0e313134779
COUNT = 86
MD = 7dbf33d7125709f101fea4ec03436ab95a900c28
COUNT = 87
MD = 0c05b78e324cb265bd6adc7452249eaa85bccb3f
COUNT = 88
MD = 10c1b9b2de8a9050fb6f4b10a99f7e1e47159f25
COUNT = 89
MD = 20072c1f691142d9b83a090dd01f446b4e325a1c
COUNT = 90
MD = ffcb6a1525f20803cfc79deb40addfd3e7b2f05c
COUNT = 91
MD = bdcbb4ed636e244bb0fe6af4bc53998936df4ebc
COUNT = 92
MD = f58ccbc65a2ffa5b35274dd0ceb4ea70eb73c26a
COUNT = 93
MD = fbe95ac75e4b9cccd1a5debf757fa1a502d07944
COUNT = 94
MD = a8babac55950dba4993601d35adff874a2b9bb2a
COUNT = 95
MD = 594db79de71c7651e9eef2f08bb7be3d26b6ee99
COUNT = 96
MD = 63377d45d0e2d0c987bebe8086c76a5e8b63a14b
COUNT = 97
MD = cd1e7a192130866aa87fd1c8b43e9b7a0eab7615
COUNT = 98
MD = b3c69ad5dbdd34b7b45b2a89dad72f4cf1d8fd73
COUNT = 99
MD = 01b7be5b70ef64843a03fdbb3b247a6278d2cbe1
# CAVS 11.1
# "SHA-1 Monte" information for "sha_values"
# SHA tests are configured for BYTE oriented implementations
# Generated on Wed May 11 17:26:02 2011
[L = 20]
Seed = dd4df644eaf3d85bace2b21accaa22b28821f5cd
COUNT = 0
MD = 11f5c38b4479d4ad55cb69fadf62de0b036d5163
COUNT = 1
MD = 5c26de848c21586bec36995809cb02d3677423d9
COUNT = 2
MD = 453b5fcf263d01c891d7897d4013990f7c1fb0ab
COUNT = 3
MD = 36d0273ae363f992bbc313aa4ff602e95c207be3
COUNT = 4
MD = d1c65e9ac55727fbf30eaf5f00cc22b9bab81a2c
COUNT = 5
MD = 2c477cd77e5749da7fc4e5ca7eed77166e8ceae6
COUNT = 6
MD = 60b11211137f46863501a32a435976eabd4532f3
COUNT = 7
MD = 0894f4f012a1e5344044e0ecfa6f078382064602
COUNT = 8
MD = 06b6222855cae9bed77e9e3050d164a98286ea5f
COUNT = 9
MD = e2872694d3d23a68a24419c35bd9ac9006248a8f
COUNT = 10
MD = ea43595eb1cff3a7e045c5868d0775b4409b14a3
COUNT = 11
MD = 05a9e94fdc792a61aa60bcd37592acee1f983280
COUNT = 12
MD = 7d11aa9413cd89a387a5c0f9aa5ce541be2aa6e8
COUNT = 13
MD = 37297d053aaa4a845cc9ce0c0165644ab8d0e00b
COUNT = 14
MD = d9dcde396d69748c1fe357f8b662a27ce89082c8
COUNT = 15
MD = 737a484499b6858b14e656c328979e8aa56b0a43
COUNT = 16
MD = 4e9c8b3bce910432ac2ad17d51e6b9ec4f92c1ad
COUNT = 17
MD = 62325b9a7cebcc6da3bfe781d84eb53a6eb7b019
COUNT = 18
MD = 4710670e071609d470f7d628d8ea978dfb9234ac
COUNT = 19
MD = 23baee80eee052f3263ac26dd12ea6504a5bd234
COUNT = 20
MD = 9451efb9c9586a403747acfa3ec74d359bb9d7ff
COUNT = 21
MD = 37e9d7c81b79f090c8e05848050936c64a1bd662
COUNT = 22
MD = a6489ff37141f7a86dd978f685fdd4789d1993dc
COUNT = 23
MD = 39650d32501dfcee212d0de10af9db47e4e5af65
COUNT = 24
MD = cd4ea3474e046b281da5a4bf69fd873ef8d568d6
COUNT = 25
MD = 0d7b518c07c6da877eee35301a99c7563f1840df
COUNT = 26
MD = 68a70ae466532f7f61af138889c0d3f9670f3590
COUNT = 27
MD = c0222aae5fd2b9eff143ac93c4493abe5c8806af
COUNT = 28
MD = d2efc5aa0b29db15f3e5de82aaa0a8ce888ffb2f
COUNT = 29
MD = eec4f55d02c627dcee36b5b5606603bdc9a94a26
COUNT = 30
MD = 0e706fb1a1fa26aab74efcef57ab6a49c07ca7bd
COUNT = 31
MD = 2ea392ca8043686424f7e9500edfb9e9297943f7
COUNT = 32
MD = 74737ef257b32a4cb9428c866b65bee62ccbe653
COUNT = 33
MD = df3e86e49a0429fa81f553b04b9fc003510e9a51
COUNT = 34
MD = 79c3049944fbf8b80dadadc7f5174e5cfdf996de
COUNT = 35
MD = f25e2eca4cfb6da8e8b7b62f581672fab80754fa
COUNT = 36
MD = 76509239d9fd6c6f050c0d9b3777b5645e4d4c70
COUNT = 37
MD = cf4bb3e1f330c862e239d9b010bd842f302bd227
COUNT = 38
MD = 4eeac7ab2ac9e4c81ed1a93a300b2af75beddb08
COUNT = 39
MD = 46443ba72a64fff4b5252fbac9ef93c2949f8585
COUNT = 40
MD = 5e9c42482343a54aadb11ab00c2e00cbe25ec91a
COUNT = 41
MD = 93acee1977128f2a4218678b32e2844f23eb526b
COUNT = 42
MD = 226065d299b2d6c582d386897b93f2adf14de00b
COUNT = 43
MD = 672fed0d90c21d4ec0111a7284bcf1bbd72af9bd
COUNT = 44
MD = 90d642f12f28cb3dad7daad84cf0f94ded1137ae
COUNT = 45
MD = 4a2815b58ffc858e5e7e9e6106765458d2af4ec3
COUNT = 46
MD = 29fa3679032421b78b7a08c54766c1592f6739c1
COUNT = 47
MD = 19f4e30393eb66c6e200744fa8999d224e6df173
COUNT = 48
MD = 30650026be77212088ab50438e04b4b8e3761977
COUNT = 49
MD = 993d0e135bcd598fa673c6f19251bcbde18b7b34
COUNT = 50
MD = c9eaf20b473219a70efe85940620426c6ff6f4a4
COUNT = 51
MD = 6325d0b83c308bd42854ce69446e85ba36348d7d
COUNT = 52
MD = 2fb354f8a68030efb747f78812060a9c05e92164
COUNT = 53
MD = a7e33bd16f770c17e8818ad5a5fc4fee673eae56
COUNT = 54
MD = ff23e7105bc9f4dad0fb9c6519d1eae16439a5d6
COUNT = 55
MD = a31aca821e163213cd2ae84cf56c1134daa4a621
COUNT = 56
MD = 94ab9cfd4cf9bf2e4409dbcdc9ef2c8b611cc69d
COUNT = 57
MD = c0194064ce48dde771b7871efa86a4a6e87eec76
COUNT = 58
MD = f1a9065e3e7f98753c6f833f5ffe74133f6b887f
COUNT = 59
MD = b8b3cd6ca1d5b5610e43212f8df75211aaddcf96
COUNT = 60
MD = 33c3a8d739cc2f83be597aa11c43e2ad6f0d2436
COUNT = 61
MD = 4f5c67e5110f3663b7aa88759dbba6fa82f2d705
COUNT = 62
MD = b1ebc87c7b2b8fe73e7a882d3f4f0492946e0d7c
COUNT = 63
MD = 01566616fe4a8c7cf22f21031ac6ea7fb7ce15db
COUNT = 64
MD = 5650f3517a393792781d23b4c9d360bf8bd31d65
COUNT = 65
MD = a4fdbd24cb4a328b898b804b103caa98baedd3fa
COUNT = 66
MD = 0cf01eecec4b85aa39f40aa9b4dce208d68eb17b
COUNT = 67
MD = ae9ac147bab7c10609abe6e931a5ab087a41dc5a
COUNT = 68
MD = c0328145ce63fb0aceeb414e791d2be92009b1ec
COUNT = 69
MD = 60343e5fb7eee00d31ea507b820ddbb7ef405dc7
COUNT = 70
MD = e0b97cd9149ff9955b6a35b3a79ecb3bdbd2a5a5
COUNT = 71
MD = 4e4fdcd382ae0f3f4fbda5fd934eee0d6ad37df5
COUNT = 72
MD = 9d97dd237d193482cf3ab862a38843762e69077f
COUNT = 73
MD = 2bc927d17ff2f8a844f6f36a944a64d73d431192
COUNT = 74
MD = b91200306b769aab18e5e411b5bd5e7bce1cc80e
COUNT = 75
MD = c47493a666085e1b7a75618761a80c402f46546d
COUNT = 76
MD = 31355869b80ff84fac239db694ada07d3be26b15
COUNT = 77
MD = 1a2022f6330bf96f025cb7d8f0201a7d70b3b58e
COUNT = 78
MD = 0f60d7c5ad49efce939c3a27da9973f7f1747848
COUNT = 79
MD = ceada087801616fc6c08cfa469658f3dc5239ca7
COUNT = 80
MD = 4ad0cf9181122b06df714397bd5366aa90bfc9fa
COUNT = 81
MD = ac6404e6b9d5c0fa17fa77fd39850f22b76ecd83
COUNT = 82
MD = f0658218adffb9ee9328577854b6387393957a3a
COUNT = 83
MD = 6fe9992747897389957b9a91467a4ec983829ab6
COUNT = 84
MD = 74320b3ddde6dbfbdad3ad29a7695f5a275b2105
COUNT = 85
MD = 2009ea5d6452f51d12477740e374e0e313134779
COUNT = 86
MD = 7dbf33d7125709f101fea4ec03436ab95a900c28
COUNT = 87
MD = 0c05b78e324cb265bd6adc7452249eaa85bccb3f
COUNT = 88
MD = 10c1b9b2de8a9050fb6f4b10a99f7e1e47159f25
COUNT = 89
MD = 20072c1f691142d9b83a090dd01f446b4e325a1c
COUNT = 90
MD = ffcb6a1525f20803cfc79deb40addfd3e7b2f05c
COUNT = 91
MD = bdcbb4ed636e244bb0fe6af4bc53998936df4ebc
COUNT = 92
MD = f58ccbc65a2ffa5b35274dd0ceb4ea70eb73c26a
COUNT = 93
MD = fbe95ac75e4b9cccd1a5debf757fa1a502d07944
COUNT = 94
MD = a8babac55950dba4993601d35adff874a2b9bb2a
COUNT = 95
MD = 594db79de71c7651e9eef2f08bb7be3d26b6ee99
COUNT = 96
MD = 63377d45d0e2d0c987bebe8086c76a5e8b63a14b
COUNT = 97
MD = cd1e7a192130866aa87fd1c8b43e9b7a0eab7615
COUNT = 98
MD = b3c69ad5dbdd34b7b45b2a89dad72f4cf1d8fd73
COUNT = 99
MD = 01b7be5b70ef64843a03fdbb3b247a6278d2cbe1

View File

@ -1,267 +1,267 @@
# CAVS 11.0
# "SHA-1 ShortMsg" information
# SHA-1 tests are configured for BYTE oriented implementations
# Generated on Tue Mar 15 08:23:35 2011
[L = 20]
Len = 0
Msg = 00
MD = da39a3ee5e6b4b0d3255bfef95601890afd80709
Len = 8
Msg = 36
MD = c1dfd96eea8cc2b62785275bca38ac261256e278
Len = 16
Msg = 195a
MD = 0a1c2d555bbe431ad6288af5a54f93e0449c9232
Len = 24
Msg = df4bd2
MD = bf36ed5d74727dfd5d7854ec6b1d49468d8ee8aa
Len = 32
Msg = 549e959e
MD = b78bae6d14338ffccfd5d5b5674a275f6ef9c717
Len = 40
Msg = f7fb1be205
MD = 60b7d5bb560a1acf6fa45721bd0abb419a841a89
Len = 48
Msg = c0e5abeaea63
MD = a6d338459780c08363090fd8fc7d28dc80e8e01f
Len = 56
Msg = 63bfc1ed7f78ab
MD = 860328d80509500c1783169ebf0ba0c4b94da5e5
Len = 64
Msg = 7e3d7b3eada98866
MD = 24a2c34b976305277ce58c2f42d5092031572520
Len = 72
Msg = 9e61e55d9ed37b1c20
MD = 411ccee1f6e3677df12698411eb09d3ff580af97
Len = 80
Msg = 9777cf90dd7c7e863506
MD = 05c915b5ed4e4c4afffc202961f3174371e90b5c
Len = 88
Msg = 4eb08c9e683c94bea00dfa
MD = af320b42d7785ca6c8dd220463be23a2d2cb5afc
Len = 96
Msg = 0938f2e2ebb64f8af8bbfc91
MD = 9f4e66b6ceea40dcf4b9166c28f1c88474141da9
Len = 104
Msg = 74c9996d14e87d3e6cbea7029d
MD = e6c4363c0852951991057f40de27ec0890466f01
Len = 112
Msg = 51dca5c0f8e5d49596f32d3eb874
MD = 046a7b396c01379a684a894558779b07d8c7da20
Len = 120
Msg = 3a36ea49684820a2adc7fc4175ba78
MD = d58a262ee7b6577c07228e71ae9b3e04c8abcda9
Len = 128
Msg = 3552694cdf663fd94b224747ac406aaf
MD = a150de927454202d94e656de4c7c0ca691de955d
Len = 136
Msg = f216a1cbde2446b1edf41e93481d33e2ed
MD = 35a4b39fef560e7ea61246676e1b7e13d587be30
Len = 144
Msg = a3cf714bf112647e727e8cfd46499acd35a6
MD = 7ce69b1acdce52ea7dbd382531fa1a83df13cae7
Len = 152
Msg = 148de640f3c11591a6f8c5c48632c5fb79d3b7
MD = b47be2c64124fa9a124a887af9551a74354ca411
Len = 160
Msg = 63a3cc83fd1ec1b6680e9974a0514e1a9ecebb6a
MD = 8bb8c0d815a9c68a1d2910f39d942603d807fbcc
Len = 168
Msg = 875a90909a8afc92fb7070047e9d081ec92f3d08b8
MD = b486f87fb833ebf0328393128646a6f6e660fcb1
Len = 176
Msg = 444b25f9c9259dc217772cc4478c44b6feff62353673
MD = 76159368f99dece30aadcfb9b7b41dab33688858
Len = 184
Msg = 487351c8a5f440e4d03386483d5fe7bb669d41adcbfdb7
MD = dbc1cb575ce6aeb9dc4ebf0f843ba8aeb1451e89
Len = 192
Msg = 46b061ef132b87f6d3b0ee2462f67d910977da20aed13705
MD = d7a98289679005eb930ab75efd8f650f991ee952
Len = 200
Msg = 3842b6137bb9d27f3ca5bafe5bbb62858344fe4ba5c41589a5
MD = fda26fa9b4874ab701ed0bb64d134f89b9c4cc50
Len = 208
Msg = 44d91d3d465a4111462ba0c7ec223da6735f4f5200453cf132c3
MD = c2ff7ccde143c8f0601f6974b1903eb8d5741b6e
Len = 216
Msg = cce73f2eabcb52f785d5a6df63c0a105f34a91ca237fe534ee399d
MD = 643c9dc20a929608f6caa9709d843ca6fa7a76f4
Len = 224
Msg = 664e6e7946839203037a65a12174b244de8cbc6ec3f578967a84f9ce
MD = 509ef787343d5b5a269229b961b96241864a3d74
Len = 232
Msg = 9597f714b2e45e3399a7f02aec44921bd78be0fefee0c5e9b499488f6e
MD = b61ce538f1a1e6c90432b233d7af5b6524ebfbe3
Len = 240
Msg = 75c5ad1f3cbd22e8a95fc3b089526788fb4ebceed3e7d4443da6e081a35e
MD = 5b7b94076b2fc20d6adb82479e6b28d07c902b75
Len = 248
Msg = dd245bffe6a638806667768360a95d0574e1a0bd0d18329fdb915ca484ac0d
MD = 6066db99fc358952cf7fb0ec4d89cb0158ed91d7
Len = 256
Msg = 0321794b739418c24e7c2e565274791c4be749752ad234ed56cb0a6347430c6b
MD = b89962c94d60f6a332fd60f6f07d4f032a586b76
Len = 264
Msg = 4c3dcf95c2f0b5258c651fcd1d51bd10425d6203067d0748d37d1340d9ddda7db3
MD = 17bda899c13d35413d2546212bcd8a93ceb0657b
Len = 272
Msg = b8d12582d25b45290a6e1bb95da429befcfdbf5b4dd41cdf3311d6988fa17cec0723
MD = badcdd53fdc144b8bf2cc1e64d10f676eebe66ed
Len = 280
Msg = 6fda97527a662552be15efaeba32a3aea4ed449abb5c1ed8d9bfff544708a425d69b72
MD = 01b4646180f1f6d2e06bbe22c20e50030322673a
Len = 288
Msg = 09fa2792acbb2417e8ed269041cc03c77006466e6e7ae002cf3f1af551e8ce0bb506d705
MD = 10016dc3a2719f9034ffcc689426d28292c42fc9
Len = 296
Msg = 5efa2987da0baf0a54d8d728792bcfa707a15798dc66743754406914d1cfe3709b1374eaeb
MD = 9f42fa2bce6ef021d93c6b2d902273797e426535
Len = 304
Msg = 2836de99c0f641cd55e89f5af76638947b8227377ef88bfba662e5682babc1ec96c6992bc9a0
MD = cdf48bacbff6f6152515323f9b43a286e0cb8113
Len = 312
Msg = 42143a2b9e1d0b354df3264d08f7b602f54aad922a3d63006d097f683dc11b90178423bff2f7fe
MD = b88fb75274b9b0fd57c0045988cfcef6c3ce6554
Len = 320
Msg = eb60c28ad8aeda807d69ebc87552024ad8aca68204f1bcd29dc5a81dd228b591e2efb7c4df75ef03
MD = c06d3a6a12d9e8db62e8cff40ca23820d61d8aa7
Len = 328
Msg = 7de4ba85ec54747cdc42b1f23546b7e490e31280f066e52fac117fd3b0792e4de62d5843ee98c72015
MD = 6e40f9e83a4be93874bc97cdebb8da6889ae2c7a
Len = 336
Msg = e70653637bc5e388ccd8dc44e5eace36f7398f2bac993042b9bc2f4fb3b0ee7e23a96439dc01134b8c7d
MD = 3efc940c312ef0dfd4e1143812248db89542f6a5
Len = 344
Msg = dd37bc9f0b3a4788f9b54966f252174c8ce487cbe59c53c22b81bf77621a7ce7616dcb5b1e2ee63c2c309b
MD = a0cf03f7badd0c3c3c4ea3717f5a4fb7e67b2e56
Len = 352
Msg = 5f485c637ae30b1e30497f0fb7ec364e13c906e2813daa34161b7ac4a4fd7a1bddd79601bbd22cef1f57cbc7
MD = a544e06f1a07ceb175a51d6d9c0111b3e15e9859
Len = 360
Msg = f6c237fb3cfe95ec8414cc16d203b4874e644cc9a543465cad2dc563488a659e8a2e7c981e2a9f22e5e868ffe1
MD = 199d986ed991b99a071f450c6b1121a727e8c735
Len = 368
Msg = da7ab3291553c659873c95913768953c6e526d3a26590898c0ade89ff56fbd110f1436af590b17fed49f8c4b2b1e
MD = 33bac6104b0ad6128d091b5d5e2999099c9f05de
Len = 376
Msg = 8cfa5fd56ee239ca47737591cba103e41a18acf8e8d257b0dbe8851134a81ff6b2e97104b39b76e19da256a17ce52d
MD = 76d7db6e18c1f4ae225ce8ccc93c8f9a0dfeb969
Len = 384
Msg = 57e89659d878f360af6de45a9a5e372ef40c384988e82640a3d5e4b76d2ef181780b9a099ac06ef0f8a7f3f764209720
MD = f652f3b1549f16710c7402895911e2b86a9b2aee
Len = 392
Msg = b91e64235dbd234eea2ae14a92a173ebe835347239cff8b02074416f55c6b60dc6ced06ae9f8d705505f0d617e4b29aef9
MD = 63faebb807f32be708cf00fc35519991dc4e7f68
Len = 400
Msg = e42a67362a581e8cf3d847502215755d7ad425ca030c4360b0f7ef513e6980265f61c9fa18dd9ce668f38dbc2a1ef8f83cd6
MD = 0e6730bc4a0e9322ea205f4edfff1fffda26af0a
Len = 408
Msg = 634db92c22010e1cbf1e1623923180406c515272209a8acc42de05cc2e96a1e94c1f9f6b93234b7f4c55de8b1961a3bf352259
MD = b61a3a6f42e8e6604b93196c43c9e84d5359e6fe
Len = 416
Msg = cc6ca3a8cb391cd8a5aff1faa7b3ffbdd21a5a3ce66cfaddbfe8b179e4c860be5ec66bd2c6de6a39a25622f9f2fcb3fc05af12b5
MD = 32d979ca1b3ed0ed8c890d99ec6dd85e6c16abf4
Len = 424
Msg = 7c0e6a0d35f8ac854c7245ebc73693731bbbc3e6fab644466de27bb522fcb99307126ae718fe8f00742e6e5cb7a687c88447cbc961
MD = 6f18190bd2d02fc93bce64756575cea36d08b1c3
Len = 432
Msg = c5581d40b331e24003901bd6bf244aca9e9601b9d81252bb38048642731f1146b8a4c69f88e148b2c8f8c14f15e1d6da57b2daa9991e
MD = 68f525feea1d8dbe0117e417ca46708d18d7629a
Len = 440
Msg = ec6b4a88713df27c0f2d02e738b69db43abda3921317259c864c1c386e9a5a3f533dc05f3beeb2bec2aac8e06db4c6cb3cddcf697e03d5
MD = a7272e2308622ff7a339460adc61efd0ea8dabdc
Len = 448
Msg = 0321736beba578e90abc1a90aa56157d871618f6de0d764cc8c91e06c68ecd3b9de3824064503384db67beb7fe012232dacaef93a000fba7
MD = aef843b86916c16f66c84d83a6005d23fd005c9e
Len = 456
Msg = d0a249a97b5f1486721a50d4c4ab3f5d674a0e29925d5bf2678ef6d8d521e456bd84aa755328c83fc890837726a8e7877b570dba39579aabdd
MD = be2cd6f380969be59cde2dff5e848a44e7880bd6
Len = 464
Msg = c32138531118f08c7dcc292428ad20b45ab27d9517a18445f38b8f0c2795bcdfe3ffe384e65ecbf74d2c9d0da88398575326074904c1709ba072
MD = e5eb4543deee8f6a5287845af8b593a95a9749a1
Len = 472
Msg = b0f4cfb939ea785eabb7e7ca7c476cdd9b227f015d905368ba00ae96b9aaf720297491b3921267576b72c8f58d577617e844f9f0759b399c6b064c
MD = 534c850448dd486787b62bdec2d4a0b140a1b170
Len = 480
Msg = bd02e51b0cf2c2b8d204a026b41a66fbfc2ac37ee9411fc449c8d1194a0792a28ee731407dfc89b6dfc2b10faa27723a184afef8fd83def858a32d3f
MD = 6fbfa6e4edce4cc85a845bf0d228dc39acefc2fa
Len = 488
Msg = e33146b83e4bb671392218da9a77f8d9f5974147182fb95ba662cb66011989c16d9af104735d6f79841aa4d1df276615b50108df8a29dbc9de31f4260d
MD = 018872691d9b04e8220e09187df5bc5fa6257cd9
Len = 496
Msg = 411c13c75073c1e2d4b1ecf13139ba9656cd35c14201f1c7c6f0eeb58d2dbfe35bfdeccc92c3961cfabb590bc1eb77eac15732fb0275798680e0c7292e50
MD = d98d512a35572f8bd20de62e9510cc21145c5bf4
Len = 504
Msg = f2c76ef617fa2bfc8a4d6bcbb15fe88436fdc2165d3074629579079d4d5b86f5081ab177b4c3f530376c9c924cbd421a8daf8830d0940c4fb7589865830699
MD = 9f3ea255f6af95c5454e55d7354cabb45352ea0b
Len = 512
Msg = 45927e32ddf801caf35e18e7b5078b7f5435278212ec6bb99df884f49b327c6486feae46ba187dc1cc9145121e1492e6b06e9007394dc33b7748f86ac3207cfe
MD = a70cfbfe7563dd0e665c7c6715a96a8d756950c0
# CAVS 11.0
# "SHA-1 ShortMsg" information
# SHA-1 tests are configured for BYTE oriented implementations
# Generated on Tue Mar 15 08:23:35 2011
[L = 20]
Len = 0
Msg = 00
MD = da39a3ee5e6b4b0d3255bfef95601890afd80709
Len = 8
Msg = 36
MD = c1dfd96eea8cc2b62785275bca38ac261256e278
Len = 16
Msg = 195a
MD = 0a1c2d555bbe431ad6288af5a54f93e0449c9232
Len = 24
Msg = df4bd2
MD = bf36ed5d74727dfd5d7854ec6b1d49468d8ee8aa
Len = 32
Msg = 549e959e
MD = b78bae6d14338ffccfd5d5b5674a275f6ef9c717
Len = 40
Msg = f7fb1be205
MD = 60b7d5bb560a1acf6fa45721bd0abb419a841a89
Len = 48
Msg = c0e5abeaea63
MD = a6d338459780c08363090fd8fc7d28dc80e8e01f
Len = 56
Msg = 63bfc1ed7f78ab
MD = 860328d80509500c1783169ebf0ba0c4b94da5e5
Len = 64
Msg = 7e3d7b3eada98866
MD = 24a2c34b976305277ce58c2f42d5092031572520
Len = 72
Msg = 9e61e55d9ed37b1c20
MD = 411ccee1f6e3677df12698411eb09d3ff580af97
Len = 80
Msg = 9777cf90dd7c7e863506
MD = 05c915b5ed4e4c4afffc202961f3174371e90b5c
Len = 88
Msg = 4eb08c9e683c94bea00dfa
MD = af320b42d7785ca6c8dd220463be23a2d2cb5afc
Len = 96
Msg = 0938f2e2ebb64f8af8bbfc91
MD = 9f4e66b6ceea40dcf4b9166c28f1c88474141da9
Len = 104
Msg = 74c9996d14e87d3e6cbea7029d
MD = e6c4363c0852951991057f40de27ec0890466f01
Len = 112
Msg = 51dca5c0f8e5d49596f32d3eb874
MD = 046a7b396c01379a684a894558779b07d8c7da20
Len = 120
Msg = 3a36ea49684820a2adc7fc4175ba78
MD = d58a262ee7b6577c07228e71ae9b3e04c8abcda9
Len = 128
Msg = 3552694cdf663fd94b224747ac406aaf
MD = a150de927454202d94e656de4c7c0ca691de955d
Len = 136
Msg = f216a1cbde2446b1edf41e93481d33e2ed
MD = 35a4b39fef560e7ea61246676e1b7e13d587be30
Len = 144
Msg = a3cf714bf112647e727e8cfd46499acd35a6
MD = 7ce69b1acdce52ea7dbd382531fa1a83df13cae7
Len = 152
Msg = 148de640f3c11591a6f8c5c48632c5fb79d3b7
MD = b47be2c64124fa9a124a887af9551a74354ca411
Len = 160
Msg = 63a3cc83fd1ec1b6680e9974a0514e1a9ecebb6a
MD = 8bb8c0d815a9c68a1d2910f39d942603d807fbcc
Len = 168
Msg = 875a90909a8afc92fb7070047e9d081ec92f3d08b8
MD = b486f87fb833ebf0328393128646a6f6e660fcb1
Len = 176
Msg = 444b25f9c9259dc217772cc4478c44b6feff62353673
MD = 76159368f99dece30aadcfb9b7b41dab33688858
Len = 184
Msg = 487351c8a5f440e4d03386483d5fe7bb669d41adcbfdb7
MD = dbc1cb575ce6aeb9dc4ebf0f843ba8aeb1451e89
Len = 192
Msg = 46b061ef132b87f6d3b0ee2462f67d910977da20aed13705
MD = d7a98289679005eb930ab75efd8f650f991ee952
Len = 200
Msg = 3842b6137bb9d27f3ca5bafe5bbb62858344fe4ba5c41589a5
MD = fda26fa9b4874ab701ed0bb64d134f89b9c4cc50
Len = 208
Msg = 44d91d3d465a4111462ba0c7ec223da6735f4f5200453cf132c3
MD = c2ff7ccde143c8f0601f6974b1903eb8d5741b6e
Len = 216
Msg = cce73f2eabcb52f785d5a6df63c0a105f34a91ca237fe534ee399d
MD = 643c9dc20a929608f6caa9709d843ca6fa7a76f4
Len = 224
Msg = 664e6e7946839203037a65a12174b244de8cbc6ec3f578967a84f9ce
MD = 509ef787343d5b5a269229b961b96241864a3d74
Len = 232
Msg = 9597f714b2e45e3399a7f02aec44921bd78be0fefee0c5e9b499488f6e
MD = b61ce538f1a1e6c90432b233d7af5b6524ebfbe3
Len = 240
Msg = 75c5ad1f3cbd22e8a95fc3b089526788fb4ebceed3e7d4443da6e081a35e
MD = 5b7b94076b2fc20d6adb82479e6b28d07c902b75
Len = 248
Msg = dd245bffe6a638806667768360a95d0574e1a0bd0d18329fdb915ca484ac0d
MD = 6066db99fc358952cf7fb0ec4d89cb0158ed91d7
Len = 256
Msg = 0321794b739418c24e7c2e565274791c4be749752ad234ed56cb0a6347430c6b
MD = b89962c94d60f6a332fd60f6f07d4f032a586b76
Len = 264
Msg = 4c3dcf95c2f0b5258c651fcd1d51bd10425d6203067d0748d37d1340d9ddda7db3
MD = 17bda899c13d35413d2546212bcd8a93ceb0657b
Len = 272
Msg = b8d12582d25b45290a6e1bb95da429befcfdbf5b4dd41cdf3311d6988fa17cec0723
MD = badcdd53fdc144b8bf2cc1e64d10f676eebe66ed
Len = 280
Msg = 6fda97527a662552be15efaeba32a3aea4ed449abb5c1ed8d9bfff544708a425d69b72
MD = 01b4646180f1f6d2e06bbe22c20e50030322673a
Len = 288
Msg = 09fa2792acbb2417e8ed269041cc03c77006466e6e7ae002cf3f1af551e8ce0bb506d705
MD = 10016dc3a2719f9034ffcc689426d28292c42fc9
Len = 296
Msg = 5efa2987da0baf0a54d8d728792bcfa707a15798dc66743754406914d1cfe3709b1374eaeb
MD = 9f42fa2bce6ef021d93c6b2d902273797e426535
Len = 304
Msg = 2836de99c0f641cd55e89f5af76638947b8227377ef88bfba662e5682babc1ec96c6992bc9a0
MD = cdf48bacbff6f6152515323f9b43a286e0cb8113
Len = 312
Msg = 42143a2b9e1d0b354df3264d08f7b602f54aad922a3d63006d097f683dc11b90178423bff2f7fe
MD = b88fb75274b9b0fd57c0045988cfcef6c3ce6554
Len = 320
Msg = eb60c28ad8aeda807d69ebc87552024ad8aca68204f1bcd29dc5a81dd228b591e2efb7c4df75ef03
MD = c06d3a6a12d9e8db62e8cff40ca23820d61d8aa7
Len = 328
Msg = 7de4ba85ec54747cdc42b1f23546b7e490e31280f066e52fac117fd3b0792e4de62d5843ee98c72015
MD = 6e40f9e83a4be93874bc97cdebb8da6889ae2c7a
Len = 336
Msg = e70653637bc5e388ccd8dc44e5eace36f7398f2bac993042b9bc2f4fb3b0ee7e23a96439dc01134b8c7d
MD = 3efc940c312ef0dfd4e1143812248db89542f6a5
Len = 344
Msg = dd37bc9f0b3a4788f9b54966f252174c8ce487cbe59c53c22b81bf77621a7ce7616dcb5b1e2ee63c2c309b
MD = a0cf03f7badd0c3c3c4ea3717f5a4fb7e67b2e56
Len = 352
Msg = 5f485c637ae30b1e30497f0fb7ec364e13c906e2813daa34161b7ac4a4fd7a1bddd79601bbd22cef1f57cbc7
MD = a544e06f1a07ceb175a51d6d9c0111b3e15e9859
Len = 360
Msg = f6c237fb3cfe95ec8414cc16d203b4874e644cc9a543465cad2dc563488a659e8a2e7c981e2a9f22e5e868ffe1
MD = 199d986ed991b99a071f450c6b1121a727e8c735
Len = 368
Msg = da7ab3291553c659873c95913768953c6e526d3a26590898c0ade89ff56fbd110f1436af590b17fed49f8c4b2b1e
MD = 33bac6104b0ad6128d091b5d5e2999099c9f05de
Len = 376
Msg = 8cfa5fd56ee239ca47737591cba103e41a18acf8e8d257b0dbe8851134a81ff6b2e97104b39b76e19da256a17ce52d
MD = 76d7db6e18c1f4ae225ce8ccc93c8f9a0dfeb969
Len = 384
Msg = 57e89659d878f360af6de45a9a5e372ef40c384988e82640a3d5e4b76d2ef181780b9a099ac06ef0f8a7f3f764209720
MD = f652f3b1549f16710c7402895911e2b86a9b2aee
Len = 392
Msg = b91e64235dbd234eea2ae14a92a173ebe835347239cff8b02074416f55c6b60dc6ced06ae9f8d705505f0d617e4b29aef9
MD = 63faebb807f32be708cf00fc35519991dc4e7f68
Len = 400
Msg = e42a67362a581e8cf3d847502215755d7ad425ca030c4360b0f7ef513e6980265f61c9fa18dd9ce668f38dbc2a1ef8f83cd6
MD = 0e6730bc4a0e9322ea205f4edfff1fffda26af0a
Len = 408
Msg = 634db92c22010e1cbf1e1623923180406c515272209a8acc42de05cc2e96a1e94c1f9f6b93234b7f4c55de8b1961a3bf352259
MD = b61a3a6f42e8e6604b93196c43c9e84d5359e6fe
Len = 416
Msg = cc6ca3a8cb391cd8a5aff1faa7b3ffbdd21a5a3ce66cfaddbfe8b179e4c860be5ec66bd2c6de6a39a25622f9f2fcb3fc05af12b5
MD = 32d979ca1b3ed0ed8c890d99ec6dd85e6c16abf4
Len = 424
Msg = 7c0e6a0d35f8ac854c7245ebc73693731bbbc3e6fab644466de27bb522fcb99307126ae718fe8f00742e6e5cb7a687c88447cbc961
MD = 6f18190bd2d02fc93bce64756575cea36d08b1c3
Len = 432
Msg = c5581d40b331e24003901bd6bf244aca9e9601b9d81252bb38048642731f1146b8a4c69f88e148b2c8f8c14f15e1d6da57b2daa9991e
MD = 68f525feea1d8dbe0117e417ca46708d18d7629a
Len = 440
Msg = ec6b4a88713df27c0f2d02e738b69db43abda3921317259c864c1c386e9a5a3f533dc05f3beeb2bec2aac8e06db4c6cb3cddcf697e03d5
MD = a7272e2308622ff7a339460adc61efd0ea8dabdc
Len = 448
Msg = 0321736beba578e90abc1a90aa56157d871618f6de0d764cc8c91e06c68ecd3b9de3824064503384db67beb7fe012232dacaef93a000fba7
MD = aef843b86916c16f66c84d83a6005d23fd005c9e
Len = 456
Msg = d0a249a97b5f1486721a50d4c4ab3f5d674a0e29925d5bf2678ef6d8d521e456bd84aa755328c83fc890837726a8e7877b570dba39579aabdd
MD = be2cd6f380969be59cde2dff5e848a44e7880bd6
Len = 464
Msg = c32138531118f08c7dcc292428ad20b45ab27d9517a18445f38b8f0c2795bcdfe3ffe384e65ecbf74d2c9d0da88398575326074904c1709ba072
MD = e5eb4543deee8f6a5287845af8b593a95a9749a1
Len = 472
Msg = b0f4cfb939ea785eabb7e7ca7c476cdd9b227f015d905368ba00ae96b9aaf720297491b3921267576b72c8f58d577617e844f9f0759b399c6b064c
MD = 534c850448dd486787b62bdec2d4a0b140a1b170
Len = 480
Msg = bd02e51b0cf2c2b8d204a026b41a66fbfc2ac37ee9411fc449c8d1194a0792a28ee731407dfc89b6dfc2b10faa27723a184afef8fd83def858a32d3f
MD = 6fbfa6e4edce4cc85a845bf0d228dc39acefc2fa
Len = 488
Msg = e33146b83e4bb671392218da9a77f8d9f5974147182fb95ba662cb66011989c16d9af104735d6f79841aa4d1df276615b50108df8a29dbc9de31f4260d
MD = 018872691d9b04e8220e09187df5bc5fa6257cd9
Len = 496
Msg = 411c13c75073c1e2d4b1ecf13139ba9656cd35c14201f1c7c6f0eeb58d2dbfe35bfdeccc92c3961cfabb590bc1eb77eac15732fb0275798680e0c7292e50
MD = d98d512a35572f8bd20de62e9510cc21145c5bf4
Len = 504
Msg = f2c76ef617fa2bfc8a4d6bcbb15fe88436fdc2165d3074629579079d4d5b86f5081ab177b4c3f530376c9c924cbd421a8daf8830d0940c4fb7589865830699
MD = 9f3ea255f6af95c5454e55d7354cabb45352ea0b
Len = 512
Msg = 45927e32ddf801caf35e18e7b5078b7f5435278212ec6bb99df884f49b327c6486feae46ba187dc1cc9145121e1492e6b06e9007394dc33b7748f86ac3207cfe
MD = a70cfbfe7563dd0e665c7c6715a96a8d756950c0

File diff suppressed because one or more lines are too long

View File

@ -1,309 +1,309 @@
# CAVS 11.1
# "SHA-224 Monte" information for "sha_values"
# SHA-224 tests are configured for BYTE oriented implementations
# Generated on Wed May 11 17:26:02 2011
[L = 28]
Seed = ed2b70d575d9d0b4196ae84a03eed940057ea89cdd729b95b7d4e6a5
COUNT = 0
MD = cd94d7da13c030208b2d0d78fcfe9ea22fa8906df66aa9a1f42afa70
COUNT = 1
MD = 555846e884633639565d5e0c01dd93ba58edb01ee18e68ccca28f7b8
COUNT = 2
MD = 44d5f4a179b33231f24cc209ed2542ddb931391f2a2d604f80ed460b
COUNT = 3
MD = 18678e3c151f05f92a89fc5b2ec56bfc6fafa66d73ffc1937fcab4d0
COUNT = 4
MD = b285f829b0499ff45f8454eda2d4e0997b3f438c2728f1a25cfbb05a
COUNT = 5
MD = 206d442c6605be0e675b0efc76243c2f18f2260a93375fb36e469631
COUNT = 6
MD = 1cd8ea34d8483b6a513c52a74e416bac2f322bbaeee02c6b0b05a781
COUNT = 7
MD = 00cee48001fe8442ef39c3433ed05473179f34205d337940d4bfd3cd
COUNT = 8
MD = ead3ad27819401912bc9abfdb50037672a3aed0e94fbaa1cc0560621
COUNT = 9
MD = 8f4dd5aef9cea829d8802ffcced2e8ed6b48ac23bbfbb0fae2fad0fd
COUNT = 10
MD = 03aeb918feab459e39af29ff3aaf406088bf06d793338bbd563641a2
COUNT = 11
MD = de80c312b153fbd7241c8bc432d1ed253d26dcc6f458b953ac2d9259
COUNT = 12
MD = 3eb8d347cc2565ddd71f7fc21cff7eb3a2cf8e85c5e1d4c751f69f26
COUNT = 13
MD = dbfd7033a4f884ecf7053f07b4c51f3efb1c09084cc7bbe667196a3e
COUNT = 14
MD = 5323fc60310fe29900eb7a500f29897001c37945c5f8849674725553
COUNT = 15
MD = c3d9416549bebebf679c0122a9c5bb86c0b514c6a4e9eda1e9782040
COUNT = 16
MD = 749fc9c8c21957ddcaf5eff69c297284d722c79be1fc6c910495a586
COUNT = 17
MD = aa307d91c4037372ff0ca60eb17ec8f1faba862601b95754783ea808
COUNT = 18
MD = 071e361909c38791e941d995b0b25a3294bdf39456cc012806ada3c5
COUNT = 19
MD = 18751a765f3b06fc2c9a1888d4bb78b2d2226799a54dba72b5429f25
COUNT = 20
MD = 54b39c96f6377e3fc2ae0ba4ec89049a6c04808da3fa0415c9053ce4
COUNT = 21
MD = 58c1eda7eab2fc4046ae153ee95de5df036dbba25b9bb5c5428ea882
COUNT = 22
MD = 3a02eaf55d04b6052b7d79b96d1e316f90f5dbbb3217dbfaea55faef
COUNT = 23
MD = c8b5eac17f450458c60c075a8f75a24a1dbc58247fcd0ccfaf03e446
COUNT = 24
MD = 53084cacfebbc4d1ff2db614b42714c18ddde36c6b7c2fbc3b1a8706
COUNT = 25
MD = 528b867aa481d42fc4931a47d24c3c905aaafa8f6dd5820c67d3579c
COUNT = 26
MD = f0a3cd3f53eb72df80ab67d264a973b6bb2f58bde8f636d9100e8864
COUNT = 27
MD = 7912f20299d803ba917f408a5a59822d147bcd1008ad5c7b678e2390
COUNT = 28
MD = 6f0e49505c15669302133d66e45d192e0c6ad02fc5b9aa128aa5517a
COUNT = 29
MD = d06aed0f18e6c377174fd00cc74a92020b3df218c376eac0501a094a
COUNT = 30
MD = cb1bbf7cc5dad591d32534c570e5bca93b8952832779dd6e0ccdc91c
COUNT = 31
MD = 4775bc11834930118654a3e66e5b7f51871d6f5068f4305dc2845574
COUNT = 32
MD = ce3b5703ed9f946ec4af62fade6e69c2751474ab8da570064ecd2ef6
COUNT = 33
MD = 49a9e1aa84700874ac27eee43f193df69ed6718b131c4854f729a32e
COUNT = 34
MD = d2c6592251a27cae7d819ac7b476c8a2ff608e57b018f79e0cf19b87
COUNT = 35
MD = a861be4fe188858b913aad179ba575cec91bed54c1ca27608daa27dc
COUNT = 36
MD = bf7975e63aa7f1bef84e7446f1c4a00a75c13285fd7c4a7a8318b1cf
COUNT = 37
MD = 5d125b14e966c9e431bdc5592d3e6305fae678dc5d6dd064fa1345f9
COUNT = 38
MD = 8c0fbb471404371145dbb66e8b1c6fc428e6dcfa263e3f5ddb47b30d
COUNT = 39
MD = 7148b69b04457296fca18e6f7b7f2145d9af9e6bc8f48b8571af0e53
COUNT = 40
MD = 0bd47a04fc42fb3d9643496e5b0719c22262f741e862adfcef91d61c
COUNT = 41
MD = 3dbb14133351e5d4bc885d9594c07f7f0f99d4a7c745eff3e7aadc2c
COUNT = 42
MD = 94f6ba7f94ba9903f7e9bde9b131353fce560c7de7159458f1a39cfa
COUNT = 43
MD = 65fc03fabbf57904f572358c20f004aa16e0b5ae6530fa961ea10b9d
COUNT = 44
MD = e46532e3e4bd0a0cb389abfba5d679e916a7c193324f1bac498ee1ee
COUNT = 45
MD = 131d096c684345311cff958706eded139676a74d97a1beb861998485
COUNT = 46
MD = fe3e03637088ac8ee2e035bfc1e7f4e944304663c832c26089e85f9f
COUNT = 47
MD = d570c2b7040fc721b41f2d213f6ee87ac1e37f2b86526cf46c699aa7
COUNT = 48
MD = 82ede72ad163b914be7c22c085cd99438b6d5557ddd3b752f0a9fb7b
COUNT = 49
MD = 343c21a0cbde3cccdbbd66eee32c50f5a54b0ac267ec3f41ec07a67f
COUNT = 50
MD = 94ad254f3b4a76f6140d0dd3775bd75eb3c081085fcb76c91b4cca92
COUNT = 51
MD = 65fa84f358bc32caaff799129bc2cad883636826415703a2dd1a3cbe
COUNT = 52
MD = 1c2f47c532856198d03dd85275357dce085c8f6c5a871aac4ff4ea28
COUNT = 53
MD = 1d51c1019131b41a076cc603f4a8e56b2f4ee70dba326af30d926827
COUNT = 54
MD = 9789daba3a8e9702d2d0b319878f88b08ebc5876dd5dff6414bf1922
COUNT = 55
MD = 1968789785f1ef61f849bcb29fbc1491c006021f729718e72f29b80d
COUNT = 56
MD = 62dca9550461f8a85e1abca4192a8a55a6e6663ebcda9ba6fb95f10c
COUNT = 57
MD = ee190aa251c1a2ae0a376b4c6b6ab3bb09f743fa01eafaab68d170e3
COUNT = 58
MD = 02273be94aaaf4a1d22496821e8abda8c418d3a4c278947c27d6c912
COUNT = 59
MD = 3998a213e392978a38016545a59bd435180da66d2b3da373088f406a
COUNT = 60
MD = 7308f2145d345bdb01c38a9993a0ec81ed5164ed0c6caabfa3b23fea
COUNT = 61
MD = 3ccde61f4734978995b7489bad8c1e6bafe03f7c3886e9b4ef0f1aa0
COUNT = 62
MD = cca9745f59f3ae2bbb8d65d31c171aa33960c8c6fa4689bb7e6d2152
COUNT = 63
MD = c976de72db46c1a254293af6093c563ce43232077c249584c016ff6f
COUNT = 64
MD = f1448af3cfe317aff1470f0a3de7bf533d77dc7f55e8dd790fd57727
COUNT = 65
MD = d4be0ccfe4913851c9636ed036c625524e72891c5c0627aae50288ce
COUNT = 66
MD = 6bd99c53693d4e2467ba6094710a6d2f48cc2ae907c4ae28604586a1
COUNT = 67
MD = 2eb4fa0872ede2a378386e40002cb00b4d1c2fca3413b944ed210915
COUNT = 68
MD = 48b624151c9d3a1cc8e9d6665d42d4e640ac91abcd3556a31ff0250c
COUNT = 69
MD = 31159840b7cb040d819ebee1ed0e52d09f5805be523cccc22eeacba9
COUNT = 70
MD = f9a67791dcae0aea00f77f8536ddba439e9fcf7e5b1ed827f83818a8
COUNT = 71
MD = a5913105fba645ba0df942da96d271a1d5efb923a4f61eb463450ea9
COUNT = 72
MD = 6ece291f81eceaa9eb5a5e228c9924f165b8b10e2cf0e143dd5fe601
COUNT = 73
MD = e07ab143f09eb8ad0d381b888adb22229c2e2a8b067e0fd012ef67a7
COUNT = 74
MD = 88a33980be5bc911c1713d5c2bd2e5ecca7fc87879501aefa9722c89
COUNT = 75
MD = a709d188da8ee187d91bd17069f785ebb379df013d78844a45b2bfe5
COUNT = 76
MD = 306fa7bd696b3e9841f84d1c861712acba0febddd7a952499b96579e
COUNT = 77
MD = 61341dee2e2869112bba2e1077fb409375f755dcafc1457bf49e0e8e
COUNT = 78
MD = 0959a6e3b727c6213119b9e8411132b5819eb848bec6ebda0b75578a
COUNT = 79
MD = 11cef0312aaedb9d0b26de64656406c8f4c358e6d3db459d364481de
COUNT = 80
MD = 5de71b191eec70e591c22ebe3a5d2973aa3172f1c272e926cc0d4873
COUNT = 81
MD = ab218bf4268aec9b41dd2db80622e4c0319cc0de12a60e06d80414ea
COUNT = 82
MD = 5c83874afe6da0443abfbbbf8ceef38f9400b63593ee7a29d467b4f5
COUNT = 83
MD = ba0fd01f699a0d00a0dff4c63f6ad19e9530a7ad11fec504e6481816
COUNT = 84
MD = 835ec2c57424baaeed09a7c0c0b6e8bf9d1cec83de4c719846c990fb
COUNT = 85
MD = 64d95f2c92343d8fca6f6914fba8814478850b5d4c2eb227f4ae6fa1
COUNT = 86
MD = f8dd5355827ac4bd040fc05ed6cb2914d013f126487a6d5f2c22f767
COUNT = 87
MD = be5bbf68d6b99749edefa6b113638ca5cf5fddfd8fcd4d719aeb54b5
COUNT = 88
MD = 3434d03e98d0af69281e7a7ff8301369c5bc6166cd29b83397ad3fd7
COUNT = 89
MD = 747b2a7cfb8c4fef7de0a08499f8b19f37e9161b855a84bd50ef84c5
COUNT = 90
MD = c1c1fa2bbb10c5672b040ed0c33d4d93e0fd210d1373fc7fd2312c0c
COUNT = 91
MD = 671f67380b7676ee7c9fbfe71f3807e3575745ec3ae3128420a141fd
COUNT = 92
MD = e88394adf710b9764a448abc6d62928b0268c6b119306f3c93d7b6d2
COUNT = 93
MD = 711cc90bfdeed121bd5a8629a9cba6df7bf8df89184ec64ee918cc67
COUNT = 94
MD = 3f63432484eaa1f389d27947a84e256618f9bc81015993cac386887a
COUNT = 95
MD = e00e0bf2a32227461230a065bbd2eeb5364277e83a850c53ef5c92e9
COUNT = 96
MD = 1977311cea23a681c83dc58a6863e362bf6c02e30f4c9c4c8439ab4e
COUNT = 97
MD = 2853a64f56c6282de53e30eba9418dd62eccb8c9a662c313b4768265
COUNT = 98
MD = ca9d0a2eeb484b9809c3850f166362d893f951f5e93cc7a3c72522e0
COUNT = 99
MD = 27033d2d89329ba9d2a39c0292552a5f1f945c115d5abf2064e93754
# CAVS 11.1
# "SHA-224 Monte" information for "sha_values"
# SHA-224 tests are configured for BYTE oriented implementations
# Generated on Wed May 11 17:26:02 2011
[L = 28]
Seed = ed2b70d575d9d0b4196ae84a03eed940057ea89cdd729b95b7d4e6a5
COUNT = 0
MD = cd94d7da13c030208b2d0d78fcfe9ea22fa8906df66aa9a1f42afa70
COUNT = 1
MD = 555846e884633639565d5e0c01dd93ba58edb01ee18e68ccca28f7b8
COUNT = 2
MD = 44d5f4a179b33231f24cc209ed2542ddb931391f2a2d604f80ed460b
COUNT = 3
MD = 18678e3c151f05f92a89fc5b2ec56bfc6fafa66d73ffc1937fcab4d0
COUNT = 4
MD = b285f829b0499ff45f8454eda2d4e0997b3f438c2728f1a25cfbb05a
COUNT = 5
MD = 206d442c6605be0e675b0efc76243c2f18f2260a93375fb36e469631
COUNT = 6
MD = 1cd8ea34d8483b6a513c52a74e416bac2f322bbaeee02c6b0b05a781
COUNT = 7
MD = 00cee48001fe8442ef39c3433ed05473179f34205d337940d4bfd3cd
COUNT = 8
MD = ead3ad27819401912bc9abfdb50037672a3aed0e94fbaa1cc0560621
COUNT = 9
MD = 8f4dd5aef9cea829d8802ffcced2e8ed6b48ac23bbfbb0fae2fad0fd
COUNT = 10
MD = 03aeb918feab459e39af29ff3aaf406088bf06d793338bbd563641a2
COUNT = 11
MD = de80c312b153fbd7241c8bc432d1ed253d26dcc6f458b953ac2d9259
COUNT = 12
MD = 3eb8d347cc2565ddd71f7fc21cff7eb3a2cf8e85c5e1d4c751f69f26
COUNT = 13
MD = dbfd7033a4f884ecf7053f07b4c51f3efb1c09084cc7bbe667196a3e
COUNT = 14
MD = 5323fc60310fe29900eb7a500f29897001c37945c5f8849674725553
COUNT = 15
MD = c3d9416549bebebf679c0122a9c5bb86c0b514c6a4e9eda1e9782040
COUNT = 16
MD = 749fc9c8c21957ddcaf5eff69c297284d722c79be1fc6c910495a586
COUNT = 17
MD = aa307d91c4037372ff0ca60eb17ec8f1faba862601b95754783ea808
COUNT = 18
MD = 071e361909c38791e941d995b0b25a3294bdf39456cc012806ada3c5
COUNT = 19
MD = 18751a765f3b06fc2c9a1888d4bb78b2d2226799a54dba72b5429f25
COUNT = 20
MD = 54b39c96f6377e3fc2ae0ba4ec89049a6c04808da3fa0415c9053ce4
COUNT = 21
MD = 58c1eda7eab2fc4046ae153ee95de5df036dbba25b9bb5c5428ea882
COUNT = 22
MD = 3a02eaf55d04b6052b7d79b96d1e316f90f5dbbb3217dbfaea55faef
COUNT = 23
MD = c8b5eac17f450458c60c075a8f75a24a1dbc58247fcd0ccfaf03e446
COUNT = 24
MD = 53084cacfebbc4d1ff2db614b42714c18ddde36c6b7c2fbc3b1a8706
COUNT = 25
MD = 528b867aa481d42fc4931a47d24c3c905aaafa8f6dd5820c67d3579c
COUNT = 26
MD = f0a3cd3f53eb72df80ab67d264a973b6bb2f58bde8f636d9100e8864
COUNT = 27
MD = 7912f20299d803ba917f408a5a59822d147bcd1008ad5c7b678e2390
COUNT = 28
MD = 6f0e49505c15669302133d66e45d192e0c6ad02fc5b9aa128aa5517a
COUNT = 29
MD = d06aed0f18e6c377174fd00cc74a92020b3df218c376eac0501a094a
COUNT = 30
MD = cb1bbf7cc5dad591d32534c570e5bca93b8952832779dd6e0ccdc91c
COUNT = 31
MD = 4775bc11834930118654a3e66e5b7f51871d6f5068f4305dc2845574
COUNT = 32
MD = ce3b5703ed9f946ec4af62fade6e69c2751474ab8da570064ecd2ef6
COUNT = 33
MD = 49a9e1aa84700874ac27eee43f193df69ed6718b131c4854f729a32e
COUNT = 34
MD = d2c6592251a27cae7d819ac7b476c8a2ff608e57b018f79e0cf19b87
COUNT = 35
MD = a861be4fe188858b913aad179ba575cec91bed54c1ca27608daa27dc
COUNT = 36
MD = bf7975e63aa7f1bef84e7446f1c4a00a75c13285fd7c4a7a8318b1cf
COUNT = 37
MD = 5d125b14e966c9e431bdc5592d3e6305fae678dc5d6dd064fa1345f9
COUNT = 38
MD = 8c0fbb471404371145dbb66e8b1c6fc428e6dcfa263e3f5ddb47b30d
COUNT = 39
MD = 7148b69b04457296fca18e6f7b7f2145d9af9e6bc8f48b8571af0e53
COUNT = 40
MD = 0bd47a04fc42fb3d9643496e5b0719c22262f741e862adfcef91d61c
COUNT = 41
MD = 3dbb14133351e5d4bc885d9594c07f7f0f99d4a7c745eff3e7aadc2c
COUNT = 42
MD = 94f6ba7f94ba9903f7e9bde9b131353fce560c7de7159458f1a39cfa
COUNT = 43
MD = 65fc03fabbf57904f572358c20f004aa16e0b5ae6530fa961ea10b9d
COUNT = 44
MD = e46532e3e4bd0a0cb389abfba5d679e916a7c193324f1bac498ee1ee
COUNT = 45
MD = 131d096c684345311cff958706eded139676a74d97a1beb861998485
COUNT = 46
MD = fe3e03637088ac8ee2e035bfc1e7f4e944304663c832c26089e85f9f
COUNT = 47
MD = d570c2b7040fc721b41f2d213f6ee87ac1e37f2b86526cf46c699aa7
COUNT = 48
MD = 82ede72ad163b914be7c22c085cd99438b6d5557ddd3b752f0a9fb7b
COUNT = 49
MD = 343c21a0cbde3cccdbbd66eee32c50f5a54b0ac267ec3f41ec07a67f
COUNT = 50
MD = 94ad254f3b4a76f6140d0dd3775bd75eb3c081085fcb76c91b4cca92
COUNT = 51
MD = 65fa84f358bc32caaff799129bc2cad883636826415703a2dd1a3cbe
COUNT = 52
MD = 1c2f47c532856198d03dd85275357dce085c8f6c5a871aac4ff4ea28
COUNT = 53
MD = 1d51c1019131b41a076cc603f4a8e56b2f4ee70dba326af30d926827
COUNT = 54
MD = 9789daba3a8e9702d2d0b319878f88b08ebc5876dd5dff6414bf1922
COUNT = 55
MD = 1968789785f1ef61f849bcb29fbc1491c006021f729718e72f29b80d
COUNT = 56
MD = 62dca9550461f8a85e1abca4192a8a55a6e6663ebcda9ba6fb95f10c
COUNT = 57
MD = ee190aa251c1a2ae0a376b4c6b6ab3bb09f743fa01eafaab68d170e3
COUNT = 58
MD = 02273be94aaaf4a1d22496821e8abda8c418d3a4c278947c27d6c912
COUNT = 59
MD = 3998a213e392978a38016545a59bd435180da66d2b3da373088f406a
COUNT = 60
MD = 7308f2145d345bdb01c38a9993a0ec81ed5164ed0c6caabfa3b23fea
COUNT = 61
MD = 3ccde61f4734978995b7489bad8c1e6bafe03f7c3886e9b4ef0f1aa0
COUNT = 62
MD = cca9745f59f3ae2bbb8d65d31c171aa33960c8c6fa4689bb7e6d2152
COUNT = 63
MD = c976de72db46c1a254293af6093c563ce43232077c249584c016ff6f
COUNT = 64
MD = f1448af3cfe317aff1470f0a3de7bf533d77dc7f55e8dd790fd57727
COUNT = 65
MD = d4be0ccfe4913851c9636ed036c625524e72891c5c0627aae50288ce
COUNT = 66
MD = 6bd99c53693d4e2467ba6094710a6d2f48cc2ae907c4ae28604586a1
COUNT = 67
MD = 2eb4fa0872ede2a378386e40002cb00b4d1c2fca3413b944ed210915
COUNT = 68
MD = 48b624151c9d3a1cc8e9d6665d42d4e640ac91abcd3556a31ff0250c
COUNT = 69
MD = 31159840b7cb040d819ebee1ed0e52d09f5805be523cccc22eeacba9
COUNT = 70
MD = f9a67791dcae0aea00f77f8536ddba439e9fcf7e5b1ed827f83818a8
COUNT = 71
MD = a5913105fba645ba0df942da96d271a1d5efb923a4f61eb463450ea9
COUNT = 72
MD = 6ece291f81eceaa9eb5a5e228c9924f165b8b10e2cf0e143dd5fe601
COUNT = 73
MD = e07ab143f09eb8ad0d381b888adb22229c2e2a8b067e0fd012ef67a7
COUNT = 74
MD = 88a33980be5bc911c1713d5c2bd2e5ecca7fc87879501aefa9722c89
COUNT = 75
MD = a709d188da8ee187d91bd17069f785ebb379df013d78844a45b2bfe5
COUNT = 76
MD = 306fa7bd696b3e9841f84d1c861712acba0febddd7a952499b96579e
COUNT = 77
MD = 61341dee2e2869112bba2e1077fb409375f755dcafc1457bf49e0e8e
COUNT = 78
MD = 0959a6e3b727c6213119b9e8411132b5819eb848bec6ebda0b75578a
COUNT = 79
MD = 11cef0312aaedb9d0b26de64656406c8f4c358e6d3db459d364481de
COUNT = 80
MD = 5de71b191eec70e591c22ebe3a5d2973aa3172f1c272e926cc0d4873
COUNT = 81
MD = ab218bf4268aec9b41dd2db80622e4c0319cc0de12a60e06d80414ea
COUNT = 82
MD = 5c83874afe6da0443abfbbbf8ceef38f9400b63593ee7a29d467b4f5
COUNT = 83
MD = ba0fd01f699a0d00a0dff4c63f6ad19e9530a7ad11fec504e6481816
COUNT = 84
MD = 835ec2c57424baaeed09a7c0c0b6e8bf9d1cec83de4c719846c990fb
COUNT = 85
MD = 64d95f2c92343d8fca6f6914fba8814478850b5d4c2eb227f4ae6fa1
COUNT = 86
MD = f8dd5355827ac4bd040fc05ed6cb2914d013f126487a6d5f2c22f767
COUNT = 87
MD = be5bbf68d6b99749edefa6b113638ca5cf5fddfd8fcd4d719aeb54b5
COUNT = 88
MD = 3434d03e98d0af69281e7a7ff8301369c5bc6166cd29b83397ad3fd7
COUNT = 89
MD = 747b2a7cfb8c4fef7de0a08499f8b19f37e9161b855a84bd50ef84c5
COUNT = 90
MD = c1c1fa2bbb10c5672b040ed0c33d4d93e0fd210d1373fc7fd2312c0c
COUNT = 91
MD = 671f67380b7676ee7c9fbfe71f3807e3575745ec3ae3128420a141fd
COUNT = 92
MD = e88394adf710b9764a448abc6d62928b0268c6b119306f3c93d7b6d2
COUNT = 93
MD = 711cc90bfdeed121bd5a8629a9cba6df7bf8df89184ec64ee918cc67
COUNT = 94
MD = 3f63432484eaa1f389d27947a84e256618f9bc81015993cac386887a
COUNT = 95
MD = e00e0bf2a32227461230a065bbd2eeb5364277e83a850c53ef5c92e9
COUNT = 96
MD = 1977311cea23a681c83dc58a6863e362bf6c02e30f4c9c4c8439ab4e
COUNT = 97
MD = 2853a64f56c6282de53e30eba9418dd62eccb8c9a662c313b4768265
COUNT = 98
MD = ca9d0a2eeb484b9809c3850f166362d893f951f5e93cc7a3c72522e0
COUNT = 99
MD = 27033d2d89329ba9d2a39c0292552a5f1f945c115d5abf2064e93754

View File

@ -1,267 +1,267 @@
# CAVS 11.0
# "SHA-224 ShortMsg" information
# SHA-224 tests are configured for BYTE oriented implementations
# Generated on Tue Mar 15 08:23:36 2011
[L = 28]
Len = 0
Msg = 00
MD = d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f
Len = 8
Msg = 84
MD = 3cd36921df5d6963e73739cf4d20211e2d8877c19cff087ade9d0e3a
Len = 16
Msg = 5c7b
MD = daff9bce685eb831f97fc1225b03c275a6c112e2d6e76f5faf7a36e6
Len = 24
Msg = 51ca3d
MD = 2c8959023515476e38388abb43599a29876b4b33d56adc06032de3a2
Len = 32
Msg = 6084347e
MD = ae57c0a6d49739ba338adfa53bdae063e5c09122b77604780a8eeaa3
Len = 40
Msg = 493e14623c
MD = 7f631f295e024e74552083245ca8f988a3fb65680ae97c3040d2e65c
Len = 48
Msg = d729d8cd1631
MD = 342e8e6b23c1c6a54910631f098e08e836259c57e49c1b1d023d166d
Len = 56
Msg = cbf2061e10faa5
MD = 3aa702b1b66dc57d7aec3ccdbdfbd88592d7520f843ba5d0fa481168
Len = 64
Msg = 5f77b3664823c33e
MD = bdf21ff325f754157ccf417f4855360a72e8fd117d28c8fe7da3ea38
Len = 72
Msg = 10713b894de4a734c0
MD = 03842600c86f5cd60c3a2147a067cb962a05303c3488b05cb45327bd
Len = 80
Msg = 006470d57dad9893dc03
MD = c90026cda5ad24115059c62ae9add57793ade445d4742273288bbce7
Len = 88
Msg = 6f29ca274190400720bba2
MD = ac53157947aa4b2a19089182382a4363d182dd8e4ca79cd8571390be
Len = 96
Msg = 17e8556176fcca2addbdde29
MD = cc6ad0488db0222066f740557b5758a19b30372b302332295d8c3aff
Len = 104
Msg = dbf163601db9a122a4026824de
MD = 9849845f4e47e1ece9a1c1e01a0d896ffea61c6c8894a75a11ce5f49
Len = 112
Msg = 5e1ef2ad86ceaf5439fe87d2ec9b
MD = 223c5d5d4a0116b32cea044f9af0fe44babea1c5ab201502591bcd5f
Len = 120
Msg = 65f3b9866fb8002b53cfaf806f702f
MD = b1e0806a218d593821fde8e9eacc44ab5287c32209a94f011ab66b75
Len = 128
Msg = b776708ffb91b3515ac46598ab9fa796
MD = 427311b1d7ab2488791c4deeb4251d783fe5f9806bfdfb5188c5443d
Len = 136
Msg = a4bc10b1a62c96d459fbaf3a5aa3face73
MD = d7e6634723ac25cb1879bdb1508da05313530419013fe255967a39e1
Len = 144
Msg = 9e8f3c6645c1749b55c50d2018ce40dc2427
MD = 2f5a583bf588c8988a572d128a95bea5ef1b66780a7d4be9c29efc31
Len = 152
Msg = 2db6d207c0b7d9117f24d78ee59abf2f316978
MD = 35681fce28307cae19522c23cbd4a77969347f7d8ee4a3088ba90ada
Len = 160
Msg = 3df5e7f399f6dd61a12a9d4e9464fc4997c1f37b
MD = a3e68076e30751085a843a6cbfbf0f3dee63d9c4219c914372e50b28
Len = 168
Msg = 65781d018f27ca0c72a9fa9ab4648ed369646dd3ce
MD = d15ef0d872d02da6427b8d0349dea2f204e67133b7365b4b150efc3c
Len = 176
Msg = af48eeddd93fee69d1bd7de428a63986011d10945eaf
MD = b89d428ee42e397cf11029ecbb27baddd036c8938f51c8ab56b875ac
Len = 184
Msg = df2bf0d5f9c994ac69d78baa0d512eceb74d8a047531c1
MD = db8e1ce68c8c6b84d6db755c2b8bf54f3c4b081a881efcddaf303294
Len = 192
Msg = 48d2f20955ea2d13433c20bc0404eb2e6ad79ed28f7cb4c0
MD = 3617cc3179f8b59adce181eebeed5e2763f62650949224a67e53694b
Len = 200
Msg = 218f74a42d3a47ef3b806601fba024b078cbff4e4b85772e0e
MD = b5f40b95dcc363b97e9d00b67c5d7c37f17ab563297d2d67a4df20c9
Len = 208
Msg = ef55b1e797000b04fcdb9b3021b09327e3b4e269d20cabdf418f
MD = 827b223d51240c2e3271c534c19c5637b6fe10083e85bcf06761ef21
Len = 216
Msg = 96df4387dc2c40297043bea36483f65e4eb1e07e93359cb7e68610
MD = 98e430a63fcdedafc9419010f7f59a4d816a45b4f973beb62530ff8c
Len = 224
Msg = 3ec0aa8d30d5ed825b77dc7095f421b1e608158797a377ff8bed641b
MD = 3108321eb7ff857f6aae69101b937f32a51ea279a6c14ba5232ac8c1
Len = 232
Msg = 8b0239712039f077ce323b35f4e306787b9b35270096e57735cff45d84
MD = a5c740d3ce46bb2e0a048488f2b0605c6d0ca0ea2f382d043d13db97
Len = 240
Msg = 044be30167a9758c46c727921dc4eb4e0dcb965623423e6fdd44e7a4ea52
MD = 6eb78313c743ea8769d8340f284dda6ded64a1db64392f21abb82c5c
Len = 248
Msg = 57f6118bacce47ecc31ce8b0c083d3c9219e0dbe9e4fbea154537c41231acc
MD = 0dbb53c866d63af44c222c76c825df0e379dcedfb958db03b6fd29a5
Len = 256
Msg = fe1f0fb02c9011f4c8c5905934ed15136771737ce31c5859e67f235fe594f5f6
MD = bbeaacc632c2a3db2a9b47f157ab54aa27776c6e74cf0bcaa91b06d5
Len = 264
Msg = 14fb01ae9d6015ecb3e56d6ecdfa4bc0533186adf8457f5e4a5c57c687895f3db3
MD = 178272c7d7cc71b15074c27e3b7997d4a3ba99626986a1a16cf30030
Len = 272
Msg = ff6c49712f044f4063c14125c0cdfba18ed8b7138453768a45dfa2d82a05f1e84227
MD = 403284c888a7280bc8bfc25f0c34182cd378306a21a1404d4e1c40cf
Len = 280
Msg = f900bd7e0117247f97c8fc7a665c76a35f571c3366571d6c4a3ee5d7fb93f1d1f726e2
MD = 48235b9820d66d8885faabf6a9ede63ba2a21b6177e987a33242373e
Len = 288
Msg = 42d38188ac49440cfefb77db975e083e6b22348c4c67f0f8692e88ad140d861dc828d595
MD = 615344f890e5bcf71b5efe39de1fc942ba1fe30dd9e9146adb6a41bf
Len = 296
Msg = 74fdd7d958b8ae7c2c3c5cff4266dfb2b3b842c9f59ecbbcaff575edcbcda08ccd6e08b764
MD = 66d7d6c54fc7775a0ba845ba3e11719fa535b9289f20b098c5f7a342
Len = 304
Msg = 934416dd0581e22f2bfbece7bb64afe820451fa21342df7e6f9fb37c4103381a1f7cd379bcc4
MD = fae8f1aa22def4dbaa814c5b0babdec43394951792c937050d2963a6
Len = 312
Msg = 102401c84a716ae72579c6ae79c359ea309ffd95abffae4c61884c03c9e99df77b6c92e492cacb
MD = 8f34812d57a16ef8a51ad987660c5f8623e0fa9d89846e28d46d14d9
Len = 320
Msg = 79bc8fb60f85d15a2386566e3e7314df284533085add1c7bb6ead3ff760c86d5633a66404761b544
MD = 65c54014cfa30f0bc27d1c6efa96ae8481f4c2505bff272956eab0df
Len = 328
Msg = db3121ea71294983b185207a9d8de3e484a66c0431bf07c962eb82977c4f834b7c3f1e7931a4a7f7a9
MD = 9316d2f021c2913d63a7e66924c87c161c3cfde0ea7ba07f54772862
Len = 336
Msg = 0dd51aa660c5cb4b7f78c46852c1db8707ab451c1367b6187388c8bb3873a1aa4210d0414cc6792a29a7
MD = 31989e7a62a5132a5070d77250d8904bb82d457dc63469d06b50185e
Len = 344
Msg = 487fd2e5b694b7071d3789a258a51e8604dc0d3e8f5d62f39131968e602abe1ddf6b0278962a512408b553
MD = e798683438284626d710877d9eea3a0e02f349fc43acb7f9f8f9e81c
Len = 352
Msg = 11183bdebfef58e4da5b1cb73be0d30b20da304d8659d921da2e270fd14626799537e4d12119e809ee97004a
MD = 96870657d6cb668be3995aa8bd31df77840d1d1915d72482e83b6b2c
Len = 360
Msg = a239de5c8e2644e8f030d94d98f1a30664e6fd961dc2977a9c08be5c31d8de89450945a53d79299ea2a1edde7f
MD = e99743d4fd26c8800c36a67b6762247c29da6b62794123c59de06dc0
Len = 368
Msg = 917c4577aa6b0f9df49999fc1c958cb09b7fd5fc80be949670f03545eb27dcaed052076b24f96f5e0f2e2f4527c0
MD = 7ecd693d4d9cf43929464698efa0bac33c2e1424f816edc769260978
Len = 376
Msg = c3f1e735a6741aa481ad577a98dbac1f03cc80ea0dae1b94db2369ed4e93facd29c64e4e77b25038279120bdfa3715
MD = 86f0d89d8e14fd8b6606412d71a7a54a347b304ea5d49c208f2266ab
Len = 384
Msg = de4fbfd553cdf37019f25afa82dc6b9970f4bb1ebbc37f80d3084c88a70722cdc523a9e3c2afbad0dc0221bfdec9a2f9
MD = 4c5262acb4a2a44eaa9bc6757024fb202ef4d5a7a16fa37252a422b5
Len = 392
Msg = db2e2eb636610cf42e9b33433acce1b3b925949f297dd83199f45d2861d64cd910c2db74a60b2089045e22cba0a536137d
MD = 16bf4e45bcdc60447c68dcb30e6b08f55ce9f4124a29cf1f9a9d065d
Len = 400
Msg = a8e729d336d5d6ac50e1e22f0b193b66e26042fc6459214129875e740ab2b142918c138aaf941863ad3b7e6065450613b273
MD = 452bf2e5ebfc4e451cc434bc09e2a10032eed0b7627cf55e7e5ed0e2
Len = 408
Msg = d05317d4b535f9d10f739d0c2dedf3ffb090c1ad9d205089b1346693f58273c4925c0face57ba45ad6fc687c66a88fc78878be
MD = 4f03c439e097b51b00e314f675937c4d911505859fb7ab16adc65e44
Len = 416
Msg = 26bb4ed4f0424c60fe4212ff8c955e89e2f553a7d7701be59416d2089af59fa1074724e214e919b1e30f33fb78374b4b055bbc9b
MD = e7c899e27009d4dc77c2d300f191b757e52c9e7eac4b023bfab2b52a
Len = 424
Msg = f015ec83944f03292463c4345fdb1c26d1ea07645facbc9520ae244b6eb191e53dabadb4ac0fb15cda4ed77dfb9e1193abfafb1b81
MD = 459e40b3fbd612912f0217c60099379ce077cd02505871b0c9c14e7a
Len = 432
Msg = 0786706f680c27b792d054faa63f499a8e6b5ddb90502946235bf74c022d772c809cb4171bfa4791539aca1abd91900e53ba93ca0efd
MD = fadebab7c3d0fb8e97e429b79083087735e4ab385a789521260ef3ad
Len = 440
Msg = 445e8698eeb8accbaac4ffa7d934fffd16014a430ef70f3a9174c6cfe96d1e3f6ab1377f4a7212dbb30146dd17d9f470c4dffc45b8e871
MD = 4c7ae028c0fe61f2a9cada61fae30685b77f04c6442576e912af9fa6
Len = 448
Msg = 52839f2f0853a30df14ec897a1914c685c1ac21470d00654c8c37663bfb65fa732dbb694d9dd09ced723b48d8f545846ba168988b61cc724
MD = 2f755a57674b49d5c25cb37348f35b6fd2de2552c749f2645ba63d20
Len = 456
Msg = 5fe8c2072d8900287ccaf07f3f66b0c22acd3e0bb91d9573754e19e373ac35271d8b43443436ac0c162850ef3d7f281409ad29a9bf716c77d1
MD = 42909757f6e229f69f04cc7a863c4e70e48c7c3575057b455c959775
Len = 464
Msg = e8064d83f3d643af8718c87e3ccd6a9733685eac61d572a22ab943f232fcb04f70858e8984449db14a76bb7eaf2458efc3ed2a32100622c52b7f
MD = 1a1d8ed54cb45c97bc970754b43eb93d9eabde4c7b07f76ad82d8ede
Len = 472
Msg = 87c9a517e28d1bb54ad20fca76460efd894d7786e68ee8d746b2f68208682157c8ad06cc324ad7a3189e09c6c39d4c768719c0a49a41669f2767d5
MD = 605977cf87b9b309bbddaaa64e528ace66b04df9f72c0e7ec88be1da
Len = 480
Msg = 59fdac3b6b32039291801c7d6f46ede8d26dc5b7a192e007116739b617569f2523680b3c0b6631af453e55805aa760c6970833ac06963bbc9dbd455e
MD = e9f0cb1dc8337e906385892f2348a8ba4412318ecad9b96e3711531f
Len = 488
Msg = 30350a4df0b58ff49c0fa09e426fcd7007b290c760c825c1855d9b0023b82caa51e3cab4c60cfa61492be50568e5ac0f6db0fd468e39e4536403e3809f
MD = 776cc6636c02408fbf65ace73ae80017108b917c16c5a912fd860241
Len = 496
Msg = ef797a0d43c30b4fe1014bdb9420879c2ff845d27e73d55a7df22930c8ece73253d8bb265b4ef2ff9c69455cc56ff25229b4126bb7bb26ee2c9ff36187b1
MD = f5b9ffb102affac352a4a535a00f89b06c268cf4881d712668906025
Len = 504
Msg = 716944de41710c29b659be10480bb25a351a39e577ee30e8f422d57cf62ad95bda39b6e70c61426e33fd84aca84cc7912d5eee45dc34076a5d2323a15c7964
MD = 61645ac748db567ac862796b8d06a47afebfa2e1783d5c5f3bcd81e2
Len = 512
Msg = a3310ba064be2e14ad32276e18cd0310c933a6e650c3c754d0243c6c61207865b4b65248f66a08edf6e0832689a9dc3a2e5d2095eeea50bd862bac88c8bd318d
MD = b2a5586d9cbf0baa999157b4af06d88ae08d7c9faab4bc1a96829d65
# CAVS 11.0
# "SHA-224 ShortMsg" information
# SHA-224 tests are configured for BYTE oriented implementations
# Generated on Tue Mar 15 08:23:36 2011
[L = 28]
Len = 0
Msg = 00
MD = d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f
Len = 8
Msg = 84
MD = 3cd36921df5d6963e73739cf4d20211e2d8877c19cff087ade9d0e3a
Len = 16
Msg = 5c7b
MD = daff9bce685eb831f97fc1225b03c275a6c112e2d6e76f5faf7a36e6
Len = 24
Msg = 51ca3d
MD = 2c8959023515476e38388abb43599a29876b4b33d56adc06032de3a2
Len = 32
Msg = 6084347e
MD = ae57c0a6d49739ba338adfa53bdae063e5c09122b77604780a8eeaa3
Len = 40
Msg = 493e14623c
MD = 7f631f295e024e74552083245ca8f988a3fb65680ae97c3040d2e65c
Len = 48
Msg = d729d8cd1631
MD = 342e8e6b23c1c6a54910631f098e08e836259c57e49c1b1d023d166d
Len = 56
Msg = cbf2061e10faa5
MD = 3aa702b1b66dc57d7aec3ccdbdfbd88592d7520f843ba5d0fa481168
Len = 64
Msg = 5f77b3664823c33e
MD = bdf21ff325f754157ccf417f4855360a72e8fd117d28c8fe7da3ea38
Len = 72
Msg = 10713b894de4a734c0
MD = 03842600c86f5cd60c3a2147a067cb962a05303c3488b05cb45327bd
Len = 80
Msg = 006470d57dad9893dc03
MD = c90026cda5ad24115059c62ae9add57793ade445d4742273288bbce7
Len = 88
Msg = 6f29ca274190400720bba2
MD = ac53157947aa4b2a19089182382a4363d182dd8e4ca79cd8571390be
Len = 96
Msg = 17e8556176fcca2addbdde29
MD = cc6ad0488db0222066f740557b5758a19b30372b302332295d8c3aff
Len = 104
Msg = dbf163601db9a122a4026824de
MD = 9849845f4e47e1ece9a1c1e01a0d896ffea61c6c8894a75a11ce5f49
Len = 112
Msg = 5e1ef2ad86ceaf5439fe87d2ec9b
MD = 223c5d5d4a0116b32cea044f9af0fe44babea1c5ab201502591bcd5f
Len = 120
Msg = 65f3b9866fb8002b53cfaf806f702f
MD = b1e0806a218d593821fde8e9eacc44ab5287c32209a94f011ab66b75
Len = 128
Msg = b776708ffb91b3515ac46598ab9fa796
MD = 427311b1d7ab2488791c4deeb4251d783fe5f9806bfdfb5188c5443d
Len = 136
Msg = a4bc10b1a62c96d459fbaf3a5aa3face73
MD = d7e6634723ac25cb1879bdb1508da05313530419013fe255967a39e1
Len = 144
Msg = 9e8f3c6645c1749b55c50d2018ce40dc2427
MD = 2f5a583bf588c8988a572d128a95bea5ef1b66780a7d4be9c29efc31
Len = 152
Msg = 2db6d207c0b7d9117f24d78ee59abf2f316978
MD = 35681fce28307cae19522c23cbd4a77969347f7d8ee4a3088ba90ada
Len = 160
Msg = 3df5e7f399f6dd61a12a9d4e9464fc4997c1f37b
MD = a3e68076e30751085a843a6cbfbf0f3dee63d9c4219c914372e50b28
Len = 168
Msg = 65781d018f27ca0c72a9fa9ab4648ed369646dd3ce
MD = d15ef0d872d02da6427b8d0349dea2f204e67133b7365b4b150efc3c
Len = 176
Msg = af48eeddd93fee69d1bd7de428a63986011d10945eaf
MD = b89d428ee42e397cf11029ecbb27baddd036c8938f51c8ab56b875ac
Len = 184
Msg = df2bf0d5f9c994ac69d78baa0d512eceb74d8a047531c1
MD = db8e1ce68c8c6b84d6db755c2b8bf54f3c4b081a881efcddaf303294
Len = 192
Msg = 48d2f20955ea2d13433c20bc0404eb2e6ad79ed28f7cb4c0
MD = 3617cc3179f8b59adce181eebeed5e2763f62650949224a67e53694b
Len = 200
Msg = 218f74a42d3a47ef3b806601fba024b078cbff4e4b85772e0e
MD = b5f40b95dcc363b97e9d00b67c5d7c37f17ab563297d2d67a4df20c9
Len = 208
Msg = ef55b1e797000b04fcdb9b3021b09327e3b4e269d20cabdf418f
MD = 827b223d51240c2e3271c534c19c5637b6fe10083e85bcf06761ef21
Len = 216
Msg = 96df4387dc2c40297043bea36483f65e4eb1e07e93359cb7e68610
MD = 98e430a63fcdedafc9419010f7f59a4d816a45b4f973beb62530ff8c
Len = 224
Msg = 3ec0aa8d30d5ed825b77dc7095f421b1e608158797a377ff8bed641b
MD = 3108321eb7ff857f6aae69101b937f32a51ea279a6c14ba5232ac8c1
Len = 232
Msg = 8b0239712039f077ce323b35f4e306787b9b35270096e57735cff45d84
MD = a5c740d3ce46bb2e0a048488f2b0605c6d0ca0ea2f382d043d13db97
Len = 240
Msg = 044be30167a9758c46c727921dc4eb4e0dcb965623423e6fdd44e7a4ea52
MD = 6eb78313c743ea8769d8340f284dda6ded64a1db64392f21abb82c5c
Len = 248
Msg = 57f6118bacce47ecc31ce8b0c083d3c9219e0dbe9e4fbea154537c41231acc
MD = 0dbb53c866d63af44c222c76c825df0e379dcedfb958db03b6fd29a5
Len = 256
Msg = fe1f0fb02c9011f4c8c5905934ed15136771737ce31c5859e67f235fe594f5f6
MD = bbeaacc632c2a3db2a9b47f157ab54aa27776c6e74cf0bcaa91b06d5
Len = 264
Msg = 14fb01ae9d6015ecb3e56d6ecdfa4bc0533186adf8457f5e4a5c57c687895f3db3
MD = 178272c7d7cc71b15074c27e3b7997d4a3ba99626986a1a16cf30030
Len = 272
Msg = ff6c49712f044f4063c14125c0cdfba18ed8b7138453768a45dfa2d82a05f1e84227
MD = 403284c888a7280bc8bfc25f0c34182cd378306a21a1404d4e1c40cf
Len = 280
Msg = f900bd7e0117247f97c8fc7a665c76a35f571c3366571d6c4a3ee5d7fb93f1d1f726e2
MD = 48235b9820d66d8885faabf6a9ede63ba2a21b6177e987a33242373e
Len = 288
Msg = 42d38188ac49440cfefb77db975e083e6b22348c4c67f0f8692e88ad140d861dc828d595
MD = 615344f890e5bcf71b5efe39de1fc942ba1fe30dd9e9146adb6a41bf
Len = 296
Msg = 74fdd7d958b8ae7c2c3c5cff4266dfb2b3b842c9f59ecbbcaff575edcbcda08ccd6e08b764
MD = 66d7d6c54fc7775a0ba845ba3e11719fa535b9289f20b098c5f7a342
Len = 304
Msg = 934416dd0581e22f2bfbece7bb64afe820451fa21342df7e6f9fb37c4103381a1f7cd379bcc4
MD = fae8f1aa22def4dbaa814c5b0babdec43394951792c937050d2963a6
Len = 312
Msg = 102401c84a716ae72579c6ae79c359ea309ffd95abffae4c61884c03c9e99df77b6c92e492cacb
MD = 8f34812d57a16ef8a51ad987660c5f8623e0fa9d89846e28d46d14d9
Len = 320
Msg = 79bc8fb60f85d15a2386566e3e7314df284533085add1c7bb6ead3ff760c86d5633a66404761b544
MD = 65c54014cfa30f0bc27d1c6efa96ae8481f4c2505bff272956eab0df
Len = 328
Msg = db3121ea71294983b185207a9d8de3e484a66c0431bf07c962eb82977c4f834b7c3f1e7931a4a7f7a9
MD = 9316d2f021c2913d63a7e66924c87c161c3cfde0ea7ba07f54772862
Len = 336
Msg = 0dd51aa660c5cb4b7f78c46852c1db8707ab451c1367b6187388c8bb3873a1aa4210d0414cc6792a29a7
MD = 31989e7a62a5132a5070d77250d8904bb82d457dc63469d06b50185e
Len = 344
Msg = 487fd2e5b694b7071d3789a258a51e8604dc0d3e8f5d62f39131968e602abe1ddf6b0278962a512408b553
MD = e798683438284626d710877d9eea3a0e02f349fc43acb7f9f8f9e81c
Len = 352
Msg = 11183bdebfef58e4da5b1cb73be0d30b20da304d8659d921da2e270fd14626799537e4d12119e809ee97004a
MD = 96870657d6cb668be3995aa8bd31df77840d1d1915d72482e83b6b2c
Len = 360
Msg = a239de5c8e2644e8f030d94d98f1a30664e6fd961dc2977a9c08be5c31d8de89450945a53d79299ea2a1edde7f
MD = e99743d4fd26c8800c36a67b6762247c29da6b62794123c59de06dc0
Len = 368
Msg = 917c4577aa6b0f9df49999fc1c958cb09b7fd5fc80be949670f03545eb27dcaed052076b24f96f5e0f2e2f4527c0
MD = 7ecd693d4d9cf43929464698efa0bac33c2e1424f816edc769260978
Len = 376
Msg = c3f1e735a6741aa481ad577a98dbac1f03cc80ea0dae1b94db2369ed4e93facd29c64e4e77b25038279120bdfa3715
MD = 86f0d89d8e14fd8b6606412d71a7a54a347b304ea5d49c208f2266ab
Len = 384
Msg = de4fbfd553cdf37019f25afa82dc6b9970f4bb1ebbc37f80d3084c88a70722cdc523a9e3c2afbad0dc0221bfdec9a2f9
MD = 4c5262acb4a2a44eaa9bc6757024fb202ef4d5a7a16fa37252a422b5
Len = 392
Msg = db2e2eb636610cf42e9b33433acce1b3b925949f297dd83199f45d2861d64cd910c2db74a60b2089045e22cba0a536137d
MD = 16bf4e45bcdc60447c68dcb30e6b08f55ce9f4124a29cf1f9a9d065d
Len = 400
Msg = a8e729d336d5d6ac50e1e22f0b193b66e26042fc6459214129875e740ab2b142918c138aaf941863ad3b7e6065450613b273
MD = 452bf2e5ebfc4e451cc434bc09e2a10032eed0b7627cf55e7e5ed0e2
Len = 408
Msg = d05317d4b535f9d10f739d0c2dedf3ffb090c1ad9d205089b1346693f58273c4925c0face57ba45ad6fc687c66a88fc78878be
MD = 4f03c439e097b51b00e314f675937c4d911505859fb7ab16adc65e44
Len = 416
Msg = 26bb4ed4f0424c60fe4212ff8c955e89e2f553a7d7701be59416d2089af59fa1074724e214e919b1e30f33fb78374b4b055bbc9b
MD = e7c899e27009d4dc77c2d300f191b757e52c9e7eac4b023bfab2b52a
Len = 424
Msg = f015ec83944f03292463c4345fdb1c26d1ea07645facbc9520ae244b6eb191e53dabadb4ac0fb15cda4ed77dfb9e1193abfafb1b81
MD = 459e40b3fbd612912f0217c60099379ce077cd02505871b0c9c14e7a
Len = 432
Msg = 0786706f680c27b792d054faa63f499a8e6b5ddb90502946235bf74c022d772c809cb4171bfa4791539aca1abd91900e53ba93ca0efd
MD = fadebab7c3d0fb8e97e429b79083087735e4ab385a789521260ef3ad
Len = 440
Msg = 445e8698eeb8accbaac4ffa7d934fffd16014a430ef70f3a9174c6cfe96d1e3f6ab1377f4a7212dbb30146dd17d9f470c4dffc45b8e871
MD = 4c7ae028c0fe61f2a9cada61fae30685b77f04c6442576e912af9fa6
Len = 448
Msg = 52839f2f0853a30df14ec897a1914c685c1ac21470d00654c8c37663bfb65fa732dbb694d9dd09ced723b48d8f545846ba168988b61cc724
MD = 2f755a57674b49d5c25cb37348f35b6fd2de2552c749f2645ba63d20
Len = 456
Msg = 5fe8c2072d8900287ccaf07f3f66b0c22acd3e0bb91d9573754e19e373ac35271d8b43443436ac0c162850ef3d7f281409ad29a9bf716c77d1
MD = 42909757f6e229f69f04cc7a863c4e70e48c7c3575057b455c959775
Len = 464
Msg = e8064d83f3d643af8718c87e3ccd6a9733685eac61d572a22ab943f232fcb04f70858e8984449db14a76bb7eaf2458efc3ed2a32100622c52b7f
MD = 1a1d8ed54cb45c97bc970754b43eb93d9eabde4c7b07f76ad82d8ede
Len = 472
Msg = 87c9a517e28d1bb54ad20fca76460efd894d7786e68ee8d746b2f68208682157c8ad06cc324ad7a3189e09c6c39d4c768719c0a49a41669f2767d5
MD = 605977cf87b9b309bbddaaa64e528ace66b04df9f72c0e7ec88be1da
Len = 480
Msg = 59fdac3b6b32039291801c7d6f46ede8d26dc5b7a192e007116739b617569f2523680b3c0b6631af453e55805aa760c6970833ac06963bbc9dbd455e
MD = e9f0cb1dc8337e906385892f2348a8ba4412318ecad9b96e3711531f
Len = 488
Msg = 30350a4df0b58ff49c0fa09e426fcd7007b290c760c825c1855d9b0023b82caa51e3cab4c60cfa61492be50568e5ac0f6db0fd468e39e4536403e3809f
MD = 776cc6636c02408fbf65ace73ae80017108b917c16c5a912fd860241
Len = 496
Msg = ef797a0d43c30b4fe1014bdb9420879c2ff845d27e73d55a7df22930c8ece73253d8bb265b4ef2ff9c69455cc56ff25229b4126bb7bb26ee2c9ff36187b1
MD = f5b9ffb102affac352a4a535a00f89b06c268cf4881d712668906025
Len = 504
Msg = 716944de41710c29b659be10480bb25a351a39e577ee30e8f422d57cf62ad95bda39b6e70c61426e33fd84aca84cc7912d5eee45dc34076a5d2323a15c7964
MD = 61645ac748db567ac862796b8d06a47afebfa2e1783d5c5f3bcd81e2
Len = 512
Msg = a3310ba064be2e14ad32276e18cd0310c933a6e650c3c754d0243c6c61207865b4b65248f66a08edf6e0832689a9dc3a2e5d2095eeea50bd862bac88c8bd318d
MD = b2a5586d9cbf0baa999157b4af06d88ae08d7c9faab4bc1a96829d65

File diff suppressed because one or more lines are too long

View File

@ -1,309 +1,309 @@
# CAVS 11.1
# "SHA-256 Monte" information for "sha_values"
# SHA-256 tests are configured for BYTE oriented implementations
# Generated on Wed May 11 17:26:03 2011
[L = 32]
Seed = 6d1e72ad03ddeb5de891e572e2396f8da015d899ef0e79503152d6010a3fe691
COUNT = 0
MD = e93c330ae5447738c8aa85d71a6c80f2a58381d05872d26bdd39f1fcd4f2b788
COUNT = 1
MD = 2e78f8c8772ea7c9331d41ed3f9cdf27d8f514a99342ee766ee3b8b0d0b121c0
COUNT = 2
MD = d6a23dff1b7f2eddc1a212f8a218397523a799b07386a30692fd6fe9d2bf0944
COUNT = 3
MD = fb0099a964fad5a88cf12952f2991ce256a4ac3049f3d389c3b9e6c00e585db4
COUNT = 4
MD = f9eba2a4cf6263826beaf6150057849eb975a9513c0b76ecad0f1c19ebbad89b
COUNT = 5
MD = 3ddf05ba8dfec982451a3e9a97695ea9cdb7098c877d0c2cd2c64e58a87754d9
COUNT = 6
MD = 2cc3fe501e3b2e33e60407b0a27025735dd04fd7623bb4fceeebae5cad67ad4b
COUNT = 7
MD = c534802a459b40c792e1fa68e54ceab69e333fbeeecad65fb124d2f3cc1f1fc1
COUNT = 8
MD = 8986e95d85e64822287c78cb7a714339431332182107109d57827776c6cc930e
COUNT = 9
MD = 72361401c670d07f1151a95e2ee914665c2bdb1228581833c7dc53b89c01c927
COUNT = 10
MD = 124c443bad9d955e084a3961b079c43c59b5e0d666af38f2f37846e85369a618
COUNT = 11
MD = 81914b78674a2a6204eef78ff51369526bf0c2e121cd364eb40a8435479dda14
COUNT = 12
MD = 8eac9d963b44021b70a527ea07420b03f51a998d0d6cb73ad4cb7fc688b4d174
COUNT = 13
MD = 0427263b4dd3ebfcb7871939dbaca5ca94e794f748c02920c9759dfa554ea534
COUNT = 14
MD = 3e9d754f2ec273b0056c2fcad2e891aaf9616fe74005d36cbf5ccba2e037b5b3
COUNT = 15
MD = 986b6594ed96a819e49edb9f65db2ea52168973d7e18ae9e0b8869a8b5dd29a0
COUNT = 16
MD = 117578126a35176a00f8c0cf999442df0890737be1880f06e6a7270959c114c6
COUNT = 17
MD = fd7f5574788d8ef64b83333ffb62e4cd3311e638db0c514071c19b84e9117afe
COUNT = 18
MD = 19db7ba6e3488a9e935af33ffb912d60c9d3b98a0be1d78e0b374dcb5274a7fb
COUNT = 19
MD = 52519e6319505df7a9aa83778618ec10b78c5771bac50e8d3f59bc815dabfb1f
COUNT = 20
MD = 434d7795fc7510af04b613e120f7f48e6d613ec056ae9fbc7c869b87c1dce63e
COUNT = 21
MD = 020324de7f6763be57bc4a6a0960258ea401ffe40d68f854e82ccfa9e0612ff7
COUNT = 22
MD = b87c7fd0ec4cd35fab077b64d00917ad06aaccb095bbe4603466644ce6cbce18
COUNT = 23
MD = 01abbd12b2b476b2d540d0c47edcb56263ea658a8080a8f08dbb313942562f00
COUNT = 24
MD = ce95bb2bf2d5c91402e13ed5271615607f39e0678aae776d18a78351b90b5838
COUNT = 25
MD = b81af264b0bb485f6656be91478f7b96c324fe262fcc366d9ce3edd44ccb85d0
COUNT = 26
MD = 9e2ad901200ca524c91373f7b5eda9cda142353e763862e350314f793a0b700d
COUNT = 27
MD = dbfabc7124338d6845f083cb1bbdf7b4060274d8e0e98d08bb7ca3779059b45b
COUNT = 28
MD = d93c2cd61f5476ea08d85f741720ab2ce5c4e38cd8254758238155fd68ea7723
COUNT = 29
MD = 232d9c3b583e297439c859150738e1b1d530812d63a9a2c1cb8e40cb50a2f27b
COUNT = 30
MD = 8b9c858bd135138d9023a0b5fcf3f12ebbc3b7f721ee0b44be1871187f21f506
COUNT = 31
MD = 05cedbd568ce9adcf5022999b8f3a28995a910c572375186da5febd775d62b79
COUNT = 32
MD = 24282cba8f5dfce7e423a103488a9a924080d549853c699159d27816dbdbe5d9
COUNT = 33
MD = ba6e3c38128f93f288e781af8a13e7ce5120c2a43a6d1c0d4edc831247350079
COUNT = 34
MD = 706fffec5b69f5ef5465b6a8663c302143af743c6b7cd5fec9f3fa9bf9b2e285
COUNT = 35
MD = 6d32c55c005eea65dacdf0e90f436943d0d0acec3c2355c36e2df1a86d1a11a7
COUNT = 36
MD = b353f425293db464ad814177ea9689f43054bcdbaf75675e918b78a82ca97a50
COUNT = 37
MD = c3fa9993130b3c95d9aed30243ba902035933d18adf5e21d2567674769062e81
COUNT = 38
MD = 1e77e07988ebd618740c2f89a7bcf0ae2542279ea8895b39aa70ba8bc37ee00f
COUNT = 39
MD = 063927892a0b095be7d21987ff8157cd4c674c1cd01ab9f0834824e8efbcf938
COUNT = 40
MD = f43054c280f05371cfbac776d43d6001f71350d898677f035aa8f7e5bd7b3fa3
COUNT = 41
MD = 2427934b28c7a9c2b18a5b7e996351aa567523744f60d54dc35bbb61f56f6fd4
COUNT = 42
MD = 3633976d174279161e13b49e5866c144ce8c1d17ec1901ad56a02c900273fe11
COUNT = 43
MD = 5f9788660d82c80155a7fea91896be3be2eb6a7b2ce963f3804cd09da5ac0c8f
COUNT = 44
MD = 097ef57de6df98c29346e67e7f676569ad402f7a1c88d1cf39ce2d44fd706f72
COUNT = 45
MD = fedcc810c74706a27fc0b6663ab2f9de0761089682dff1279fcd91312af1b8e3
COUNT = 46
MD = bd5d61fea8d23089f3f30266b1daa636a352e49476526e71cc0735cbd17054fe
COUNT = 47
MD = 5ead027c03d7a55c17f0c783b6d77670cdb8942772077d09dff9a46ecd527bec
COUNT = 48
MD = 7a06eeea07ca9eb94a98a5e9f00b7efd8de9843b6aa888822c3dccf803637732
COUNT = 49
MD = 44b6a895058ed3f31a5549407af8f788631f8a6eb8c0a5f2e15facc9190b5672
COUNT = 50
MD = f8a58bff4b54aaebe18fc3f0bb1d24974a125530756dd4a0f15628c35c02ea1c
COUNT = 51
MD = 3bf2ae5408399aba59f42e5bed35a00d038fada16013ffa5da9e8b7207f6012c
COUNT = 52
MD = 31d33c0275986b06f6dccf570d1064c7b36e1574cc4371d4bba2e55321d75397
COUNT = 53
MD = bda59cbd65e87a57df3f03c89e4d9511de71da05e2eee0560948696b37615f8f
COUNT = 54
MD = f431cc1817569e92c8ba11ec4741e6dd2e361156575af7b482587ed78e9fb7fe
COUNT = 55
MD = 1b3b3789a32165f725167da6f5ef89d95de5992783961440fce67b66c3351ea6
COUNT = 56
MD = c9873a09c079ca7f477b5601519ce51896c2a35a28fe05fe8b13e990813c6634
COUNT = 57
MD = fb16cc865ddcf513be298c7d514033ab3fae7a80b285d2b43e82363342e498f4
COUNT = 58
MD = ebaebc261b327f8be24026e32099a6b15927c54dbe390b72756f3f6362ea3b3a
COUNT = 59
MD = ae5a4fdc779d808ba898966c8c14a6c9894107ef3e1d680f6ae37e95cb7e1b67
COUNT = 60
MD = 5a4a67451c197b038c540878b6e7bc6fce3eea9c95795d611359703d6cc7ca02
COUNT = 61
MD = efb075aa051070a6b2303e026f81a5262a6e64eabb270ec5e13fc6efa3529f6f
COUNT = 62
MD = 8ff3df1a5cd0840bce61520f1e5645ce272a37b884c1750c69a957134c1a20d2
COUNT = 63
MD = 8fbd86567c20dc3ea9948dd5ea6f5204028c4ba258c35052994e7c86de2d7701
COUNT = 64
MD = 670559572a74e9af0513a3f9243bfbfd5805b837705faedc3c480d67a92bc124
COUNT = 65
MD = ef2ad8656fac9c593d301fcfac77a7815d50b42526d3a44e1573316a25b05904
COUNT = 66
MD = a3484a7a6cb5c941e15346a3ac4e09e99a5189cc96a87104d196af3c43cf995e
COUNT = 67
MD = 966851a0ef41f8d8ff970f4340a8dae8eec4f1999f5fd4f6cbcfa372fbf85495
COUNT = 68
MD = 8e1559cd4431febfa15662a2ccf2cac82f5401b2657551480bb0e3dd2111032c
COUNT = 69
MD = 5f535e2e7351cb8caf0070166218238a843c17472cea2f5911008be5d7fd6ba2
COUNT = 70
MD = 86ac4ea15f10c264b158058f5c13a36a87ac72f840071bbc45399b36823a5709
COUNT = 71
MD = 5c0d3fe289b2aac7d1bbaf57f4154b8d10875cffc9d8bd2402255ed1615f1d5f
COUNT = 72
MD = d7d808366d0c8b76ce3e7ab80ea11b4e2f8758f9ff404a3aafbf5b0cc191adcb
COUNT = 73
MD = e0768536856d1d7399667d6fd2c32f72416eeea1c40a313ee6edc910a5c3b786
COUNT = 74
MD = d670923731b3e598f5c4db4c7e57fe2275cc6c49b4bf67cb91d520846aec256e
COUNT = 75
MD = 2cb0bdcc305ef3b3d6b7265ab62bee555c524102679da122424713a9a01d69f6
COUNT = 76
MD = 5acdc323fe067a4b915ee521ac8eb81bcff4e205d53e4e7f9a69d436035cc5ad
COUNT = 77
MD = e634c43558d12c2a8710f2d6f10a86411cfad5a014e6b6cc159733c8ccece283
COUNT = 78
MD = 4a05f4bc3fcaf50e6d0916d7e7024b0ed22e9a3c413ff4bbcc0922d2326dcf6e
COUNT = 79
MD = 17c9d6029e15d3fd84e6809c5ef8a279a040f49ada91601a3ba4572cef7c08bd
COUNT = 80
MD = 1f21e137da2427536758409f3fbf5842589c5f587f0b9d2d10430f840faaaf45
COUNT = 81
MD = e3d38cff8a8d7fc00693dca5e37b03e7b10dafe4926023e26d937106ddac6a78
COUNT = 82
MD = cd749eb05c67038fe837910310b3b4cdda190f6235fa970602f865bec1b61a1b
COUNT = 83
MD = d596ccddea01b4ae29b68b0e8a191007f0c89a1016c380b49786f2d4fac4c43d
COUNT = 84
MD = cbccb1ff23e33c59dc4c858093c9e215c3759acfe6bc84ff75940b59b25a4e40
COUNT = 85
MD = 7214c134e9a963d6c43969d3ef44ece825dd9cf35bda5fcce92a6b9d0d3fd1b8
COUNT = 86
MD = aceaf5b775779621319f9ab5d4d370a3359cd6553ed2328cdc9dbab5b68840fa
COUNT = 87
MD = e8123acb0a2fb62978d3811b31676975542993932108ab14d487ad7875ddef72
COUNT = 88
MD = 660202a436fb05c3d59be699734e77c9750c906c8597ca213d064853ecf8c9f3
COUNT = 89
MD = 4752b0a5ec3f1fb295d5bfa98fa63a0ba38a02a4c1e1f73b0c4d4e88a07e0317
COUNT = 90
MD = 1e24f1467c36b051af3241fcf8c2c868b86dcb8e4669931878018e9914129b42
COUNT = 91
MD = d1c3efc99d9487e147282d811ab932d4a24362d09ac909f4854e783887068891
COUNT = 92
MD = 7dc455cf6f8b2042b6f0f368c44f18a080e5d3912ce3cdaf7142bd61ae50d02e
COUNT = 93
MD = 4b991c15789084eb1d6c1d7ce8f0928df4d3931c0c22c571f375849b9a6c2b71
COUNT = 94
MD = 8b78f95a007cfb0bd054a1f5d962cd8d927665f79a5ce9e0fc31105e57b8460b
COUNT = 95
MD = bf305423849cf773fc54206d8ae3c000c3e8b359cba8364581d1f91b0a201032
COUNT = 96
MD = 47006af96cff3843d3ed53bdedb167490d7bfefd93ae3e9ef473cb53aa840fc0
COUNT = 97
MD = c53cf5026162021fd2345dbad7c53d3a3df47b5bdff8cd34a0ccfee06dbb7328
COUNT = 98
MD = 3326899b575f93cdaff757f8ab7c3996a2fe930450d5002d4575f4e4cc4b4360
COUNT = 99
MD = 6a912ba4188391a78e6f13d88ed2d14e13afce9db6f7dcbf4a48c24f3db02778
# CAVS 11.1
# "SHA-256 Monte" information for "sha_values"
# SHA-256 tests are configured for BYTE oriented implementations
# Generated on Wed May 11 17:26:03 2011
[L = 32]
Seed = 6d1e72ad03ddeb5de891e572e2396f8da015d899ef0e79503152d6010a3fe691
COUNT = 0
MD = e93c330ae5447738c8aa85d71a6c80f2a58381d05872d26bdd39f1fcd4f2b788
COUNT = 1
MD = 2e78f8c8772ea7c9331d41ed3f9cdf27d8f514a99342ee766ee3b8b0d0b121c0
COUNT = 2
MD = d6a23dff1b7f2eddc1a212f8a218397523a799b07386a30692fd6fe9d2bf0944
COUNT = 3
MD = fb0099a964fad5a88cf12952f2991ce256a4ac3049f3d389c3b9e6c00e585db4
COUNT = 4
MD = f9eba2a4cf6263826beaf6150057849eb975a9513c0b76ecad0f1c19ebbad89b
COUNT = 5
MD = 3ddf05ba8dfec982451a3e9a97695ea9cdb7098c877d0c2cd2c64e58a87754d9
COUNT = 6
MD = 2cc3fe501e3b2e33e60407b0a27025735dd04fd7623bb4fceeebae5cad67ad4b
COUNT = 7
MD = c534802a459b40c792e1fa68e54ceab69e333fbeeecad65fb124d2f3cc1f1fc1
COUNT = 8
MD = 8986e95d85e64822287c78cb7a714339431332182107109d57827776c6cc930e
COUNT = 9
MD = 72361401c670d07f1151a95e2ee914665c2bdb1228581833c7dc53b89c01c927
COUNT = 10
MD = 124c443bad9d955e084a3961b079c43c59b5e0d666af38f2f37846e85369a618
COUNT = 11
MD = 81914b78674a2a6204eef78ff51369526bf0c2e121cd364eb40a8435479dda14
COUNT = 12
MD = 8eac9d963b44021b70a527ea07420b03f51a998d0d6cb73ad4cb7fc688b4d174
COUNT = 13
MD = 0427263b4dd3ebfcb7871939dbaca5ca94e794f748c02920c9759dfa554ea534
COUNT = 14
MD = 3e9d754f2ec273b0056c2fcad2e891aaf9616fe74005d36cbf5ccba2e037b5b3
COUNT = 15
MD = 986b6594ed96a819e49edb9f65db2ea52168973d7e18ae9e0b8869a8b5dd29a0
COUNT = 16
MD = 117578126a35176a00f8c0cf999442df0890737be1880f06e6a7270959c114c6
COUNT = 17
MD = fd7f5574788d8ef64b83333ffb62e4cd3311e638db0c514071c19b84e9117afe
COUNT = 18
MD = 19db7ba6e3488a9e935af33ffb912d60c9d3b98a0be1d78e0b374dcb5274a7fb
COUNT = 19
MD = 52519e6319505df7a9aa83778618ec10b78c5771bac50e8d3f59bc815dabfb1f
COUNT = 20
MD = 434d7795fc7510af04b613e120f7f48e6d613ec056ae9fbc7c869b87c1dce63e
COUNT = 21
MD = 020324de7f6763be57bc4a6a0960258ea401ffe40d68f854e82ccfa9e0612ff7
COUNT = 22
MD = b87c7fd0ec4cd35fab077b64d00917ad06aaccb095bbe4603466644ce6cbce18
COUNT = 23
MD = 01abbd12b2b476b2d540d0c47edcb56263ea658a8080a8f08dbb313942562f00
COUNT = 24
MD = ce95bb2bf2d5c91402e13ed5271615607f39e0678aae776d18a78351b90b5838
COUNT = 25
MD = b81af264b0bb485f6656be91478f7b96c324fe262fcc366d9ce3edd44ccb85d0
COUNT = 26
MD = 9e2ad901200ca524c91373f7b5eda9cda142353e763862e350314f793a0b700d
COUNT = 27
MD = dbfabc7124338d6845f083cb1bbdf7b4060274d8e0e98d08bb7ca3779059b45b
COUNT = 28
MD = d93c2cd61f5476ea08d85f741720ab2ce5c4e38cd8254758238155fd68ea7723
COUNT = 29
MD = 232d9c3b583e297439c859150738e1b1d530812d63a9a2c1cb8e40cb50a2f27b
COUNT = 30
MD = 8b9c858bd135138d9023a0b5fcf3f12ebbc3b7f721ee0b44be1871187f21f506
COUNT = 31
MD = 05cedbd568ce9adcf5022999b8f3a28995a910c572375186da5febd775d62b79
COUNT = 32
MD = 24282cba8f5dfce7e423a103488a9a924080d549853c699159d27816dbdbe5d9
COUNT = 33
MD = ba6e3c38128f93f288e781af8a13e7ce5120c2a43a6d1c0d4edc831247350079
COUNT = 34
MD = 706fffec5b69f5ef5465b6a8663c302143af743c6b7cd5fec9f3fa9bf9b2e285
COUNT = 35
MD = 6d32c55c005eea65dacdf0e90f436943d0d0acec3c2355c36e2df1a86d1a11a7
COUNT = 36
MD = b353f425293db464ad814177ea9689f43054bcdbaf75675e918b78a82ca97a50
COUNT = 37
MD = c3fa9993130b3c95d9aed30243ba902035933d18adf5e21d2567674769062e81
COUNT = 38
MD = 1e77e07988ebd618740c2f89a7bcf0ae2542279ea8895b39aa70ba8bc37ee00f
COUNT = 39
MD = 063927892a0b095be7d21987ff8157cd4c674c1cd01ab9f0834824e8efbcf938
COUNT = 40
MD = f43054c280f05371cfbac776d43d6001f71350d898677f035aa8f7e5bd7b3fa3
COUNT = 41
MD = 2427934b28c7a9c2b18a5b7e996351aa567523744f60d54dc35bbb61f56f6fd4
COUNT = 42
MD = 3633976d174279161e13b49e5866c144ce8c1d17ec1901ad56a02c900273fe11
COUNT = 43
MD = 5f9788660d82c80155a7fea91896be3be2eb6a7b2ce963f3804cd09da5ac0c8f
COUNT = 44
MD = 097ef57de6df98c29346e67e7f676569ad402f7a1c88d1cf39ce2d44fd706f72
COUNT = 45
MD = fedcc810c74706a27fc0b6663ab2f9de0761089682dff1279fcd91312af1b8e3
COUNT = 46
MD = bd5d61fea8d23089f3f30266b1daa636a352e49476526e71cc0735cbd17054fe
COUNT = 47
MD = 5ead027c03d7a55c17f0c783b6d77670cdb8942772077d09dff9a46ecd527bec
COUNT = 48
MD = 7a06eeea07ca9eb94a98a5e9f00b7efd8de9843b6aa888822c3dccf803637732
COUNT = 49
MD = 44b6a895058ed3f31a5549407af8f788631f8a6eb8c0a5f2e15facc9190b5672
COUNT = 50
MD = f8a58bff4b54aaebe18fc3f0bb1d24974a125530756dd4a0f15628c35c02ea1c
COUNT = 51
MD = 3bf2ae5408399aba59f42e5bed35a00d038fada16013ffa5da9e8b7207f6012c
COUNT = 52
MD = 31d33c0275986b06f6dccf570d1064c7b36e1574cc4371d4bba2e55321d75397
COUNT = 53
MD = bda59cbd65e87a57df3f03c89e4d9511de71da05e2eee0560948696b37615f8f
COUNT = 54
MD = f431cc1817569e92c8ba11ec4741e6dd2e361156575af7b482587ed78e9fb7fe
COUNT = 55
MD = 1b3b3789a32165f725167da6f5ef89d95de5992783961440fce67b66c3351ea6
COUNT = 56
MD = c9873a09c079ca7f477b5601519ce51896c2a35a28fe05fe8b13e990813c6634
COUNT = 57
MD = fb16cc865ddcf513be298c7d514033ab3fae7a80b285d2b43e82363342e498f4
COUNT = 58
MD = ebaebc261b327f8be24026e32099a6b15927c54dbe390b72756f3f6362ea3b3a
COUNT = 59
MD = ae5a4fdc779d808ba898966c8c14a6c9894107ef3e1d680f6ae37e95cb7e1b67
COUNT = 60
MD = 5a4a67451c197b038c540878b6e7bc6fce3eea9c95795d611359703d6cc7ca02
COUNT = 61
MD = efb075aa051070a6b2303e026f81a5262a6e64eabb270ec5e13fc6efa3529f6f
COUNT = 62
MD = 8ff3df1a5cd0840bce61520f1e5645ce272a37b884c1750c69a957134c1a20d2
COUNT = 63
MD = 8fbd86567c20dc3ea9948dd5ea6f5204028c4ba258c35052994e7c86de2d7701
COUNT = 64
MD = 670559572a74e9af0513a3f9243bfbfd5805b837705faedc3c480d67a92bc124
COUNT = 65
MD = ef2ad8656fac9c593d301fcfac77a7815d50b42526d3a44e1573316a25b05904
COUNT = 66
MD = a3484a7a6cb5c941e15346a3ac4e09e99a5189cc96a87104d196af3c43cf995e
COUNT = 67
MD = 966851a0ef41f8d8ff970f4340a8dae8eec4f1999f5fd4f6cbcfa372fbf85495
COUNT = 68
MD = 8e1559cd4431febfa15662a2ccf2cac82f5401b2657551480bb0e3dd2111032c
COUNT = 69
MD = 5f535e2e7351cb8caf0070166218238a843c17472cea2f5911008be5d7fd6ba2
COUNT = 70
MD = 86ac4ea15f10c264b158058f5c13a36a87ac72f840071bbc45399b36823a5709
COUNT = 71
MD = 5c0d3fe289b2aac7d1bbaf57f4154b8d10875cffc9d8bd2402255ed1615f1d5f
COUNT = 72
MD = d7d808366d0c8b76ce3e7ab80ea11b4e2f8758f9ff404a3aafbf5b0cc191adcb
COUNT = 73
MD = e0768536856d1d7399667d6fd2c32f72416eeea1c40a313ee6edc910a5c3b786
COUNT = 74
MD = d670923731b3e598f5c4db4c7e57fe2275cc6c49b4bf67cb91d520846aec256e
COUNT = 75
MD = 2cb0bdcc305ef3b3d6b7265ab62bee555c524102679da122424713a9a01d69f6
COUNT = 76
MD = 5acdc323fe067a4b915ee521ac8eb81bcff4e205d53e4e7f9a69d436035cc5ad
COUNT = 77
MD = e634c43558d12c2a8710f2d6f10a86411cfad5a014e6b6cc159733c8ccece283
COUNT = 78
MD = 4a05f4bc3fcaf50e6d0916d7e7024b0ed22e9a3c413ff4bbcc0922d2326dcf6e
COUNT = 79
MD = 17c9d6029e15d3fd84e6809c5ef8a279a040f49ada91601a3ba4572cef7c08bd
COUNT = 80
MD = 1f21e137da2427536758409f3fbf5842589c5f587f0b9d2d10430f840faaaf45
COUNT = 81
MD = e3d38cff8a8d7fc00693dca5e37b03e7b10dafe4926023e26d937106ddac6a78
COUNT = 82
MD = cd749eb05c67038fe837910310b3b4cdda190f6235fa970602f865bec1b61a1b
COUNT = 83
MD = d596ccddea01b4ae29b68b0e8a191007f0c89a1016c380b49786f2d4fac4c43d
COUNT = 84
MD = cbccb1ff23e33c59dc4c858093c9e215c3759acfe6bc84ff75940b59b25a4e40
COUNT = 85
MD = 7214c134e9a963d6c43969d3ef44ece825dd9cf35bda5fcce92a6b9d0d3fd1b8
COUNT = 86
MD = aceaf5b775779621319f9ab5d4d370a3359cd6553ed2328cdc9dbab5b68840fa
COUNT = 87
MD = e8123acb0a2fb62978d3811b31676975542993932108ab14d487ad7875ddef72
COUNT = 88
MD = 660202a436fb05c3d59be699734e77c9750c906c8597ca213d064853ecf8c9f3
COUNT = 89
MD = 4752b0a5ec3f1fb295d5bfa98fa63a0ba38a02a4c1e1f73b0c4d4e88a07e0317
COUNT = 90
MD = 1e24f1467c36b051af3241fcf8c2c868b86dcb8e4669931878018e9914129b42
COUNT = 91
MD = d1c3efc99d9487e147282d811ab932d4a24362d09ac909f4854e783887068891
COUNT = 92
MD = 7dc455cf6f8b2042b6f0f368c44f18a080e5d3912ce3cdaf7142bd61ae50d02e
COUNT = 93
MD = 4b991c15789084eb1d6c1d7ce8f0928df4d3931c0c22c571f375849b9a6c2b71
COUNT = 94
MD = 8b78f95a007cfb0bd054a1f5d962cd8d927665f79a5ce9e0fc31105e57b8460b
COUNT = 95
MD = bf305423849cf773fc54206d8ae3c000c3e8b359cba8364581d1f91b0a201032
COUNT = 96
MD = 47006af96cff3843d3ed53bdedb167490d7bfefd93ae3e9ef473cb53aa840fc0
COUNT = 97
MD = c53cf5026162021fd2345dbad7c53d3a3df47b5bdff8cd34a0ccfee06dbb7328
COUNT = 98
MD = 3326899b575f93cdaff757f8ab7c3996a2fe930450d5002d4575f4e4cc4b4360
COUNT = 99
MD = 6a912ba4188391a78e6f13d88ed2d14e13afce9db6f7dcbf4a48c24f3db02778

View File

@ -1,267 +1,267 @@
# CAVS 11.0
# "SHA-256 ShortMsg" information
# SHA-256 tests are configured for BYTE oriented implementations
# Generated on Tue Mar 15 08:23:38 2011
[L = 32]
Len = 0
Msg = 00
MD = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Len = 8
Msg = d3
MD = 28969cdfa74a12c82f3bad960b0b000aca2ac329deea5c2328ebc6f2ba9802c1
Len = 16
Msg = 11af
MD = 5ca7133fa735326081558ac312c620eeca9970d1e70a4b95533d956f072d1f98
Len = 24
Msg = b4190e
MD = dff2e73091f6c05e528896c4c831b9448653dc2ff043528f6769437bc7b975c2
Len = 32
Msg = 74ba2521
MD = b16aa56be3880d18cd41e68384cf1ec8c17680c45a02b1575dc1518923ae8b0e
Len = 40
Msg = c299209682
MD = f0887fe961c9cd3beab957e8222494abb969b1ce4c6557976df8b0f6d20e9166
Len = 48
Msg = e1dc724d5621
MD = eca0a060b489636225b4fa64d267dabbe44273067ac679f20820bddc6b6a90ac
Len = 56
Msg = 06e076f5a442d5
MD = 3fd877e27450e6bbd5d74bb82f9870c64c66e109418baa8e6bbcff355e287926
Len = 64
Msg = 5738c929c4f4ccb6
MD = 963bb88f27f512777aab6c8b1a02c70ec0ad651d428f870036e1917120fb48bf
Len = 72
Msg = 3334c58075d3f4139e
MD = 078da3d77ed43bd3037a433fd0341855023793f9afd08b4b08ea1e5597ceef20
Len = 80
Msg = 74cb9381d89f5aa73368
MD = 73d6fad1caaa75b43b21733561fd3958bdc555194a037c2addec19dc2d7a52bd
Len = 88
Msg = 76ed24a0f40a41221ebfcf
MD = 044cef802901932e46dc46b2545e6c99c0fc323a0ed99b081bda4216857f38ac
Len = 96
Msg = 9baf69cba317f422fe26a9a0
MD = fe56287cd657e4afc50dba7a3a54c2a6324b886becdcd1fae473b769e551a09b
Len = 104
Msg = 68511cdb2dbbf3530d7fb61cbc
MD = af53430466715e99a602fc9f5945719b04dd24267e6a98471f7a7869bd3b4313
Len = 112
Msg = af397a8b8dd73ab702ce8e53aa9f
MD = d189498a3463b18e846b8ab1b41583b0b7efc789dad8a7fb885bbf8fb5b45c5c
Len = 120
Msg = 294af4802e5e925eb1c6cc9c724f09
MD = dcbaf335360de853b9cddfdafb90fa75567d0d3d58af8db9d764113aef570125
Len = 128
Msg = 0a27847cdc98bd6f62220b046edd762b
MD = 80c25ec1600587e7f28b18b1b18e3cdc89928e39cab3bc25e4d4a4c139bcedc4
Len = 136
Msg = 1b503fb9a73b16ada3fcf1042623ae7610
MD = d5c30315f72ed05fe519a1bf75ab5fd0ffec5ac1acb0daf66b6b769598594509
Len = 144
Msg = 59eb45bbbeb054b0b97334d53580ce03f699
MD = 32c38c54189f2357e96bd77eb00c2b9c341ebebacc2945f97804f59a93238288
Len = 152
Msg = 58e5a3259cb0b6d12c83f723379e35fd298b60
MD = 9b5b37816de8fcdf3ec10b745428708df8f391c550ea6746b2cafe019c2b6ace
Len = 160
Msg = c1ef39cee58e78f6fcdc12e058b7f902acd1a93b
MD = 6dd52b0d8b48cc8146cebd0216fbf5f6ef7eeafc0ff2ff9d1422d6345555a142
Len = 168
Msg = 9cab7d7dcaec98cb3ac6c64dd5d4470d0b103a810c
MD = 44d34809fc60d1fcafa7f37b794d1d3a765dd0d23194ebbe340f013f0c39b613
Len = 176
Msg = ea157c02ebaf1b22de221b53f2353936d2359d1e1c97
MD = 9df5c16a3f580406f07d96149303d8c408869b32053b726cf3defd241e484957
Len = 184
Msg = da999bc1f9c7acff32828a73e672d0a492f6ee895c6867
MD = 672b54e43f41ee77584bdf8bf854d97b6252c918f7ea2d26bc4097ea53a88f10
Len = 192
Msg = 47991301156d1d977c0338efbcad41004133aefbca6bcf7e
MD = feeb4b2b59fec8fdb1e55194a493d8c871757b5723675e93d3ac034b380b7fc9
Len = 200
Msg = 2e7ea84da4bc4d7cfb463e3f2c8647057afff3fbececa1d200
MD = 76e3acbc718836f2df8ad2d0d2d76f0cfa5fea0986be918f10bcee730df441b9
Len = 208
Msg = 47c770eb4549b6eff6381d62e9beb464cd98d341cc1c09981a7a
MD = 6733809c73e53666c735b3bd3daf87ebc77c72756150a616a194108d71231272
Len = 216
Msg = ac4c26d8b43b8579d8f61c9807026e83e9b586e1159bd43b851937
MD = 0e6e3c143c3a5f7f38505ed6adc9b48c18edf6dedf11635f6e8f9ac73c39fe9e
Len = 224
Msg = 0777fc1e1ca47304c2e265692838109e26aab9e5c4ae4e8600df4b1f
MD = ffb4fc03e054f8ecbc31470fc023bedcd4a406b9dd56c71da1b660dcc4842c65
Len = 232
Msg = 1a57251c431d4e6c2e06d65246a296915071a531425ecf255989422a66
MD = c644612cd326b38b1c6813b1daded34448805aef317c35f548dfb4a0d74b8106
Len = 240
Msg = 9b245fdad9baeb890d9c0d0eff816efb4ca138610bc7d78cb1a801ed3273
MD = c0e29eeeb0d3a7707947e623cdc7d1899adc70dd7861205ea5e5813954fb7957
Len = 248
Msg = 95a765809caf30ada90ad6d61c2b4b30250df0a7ce23b7753c9187f4319ce2
MD = a4139b74b102cf1e2fce229a6cd84c87501f50afa4c80feacf7d8cf5ed94f042
Len = 256
Msg = 09fc1accc230a205e4a208e64a8f204291f581a12756392da4b8c0cf5ef02b95
MD = 4f44c1c7fbebb6f9601829f3897bfd650c56fa07844be76489076356ac1886a4
Len = 264
Msg = 0546f7b8682b5b95fd32385faf25854cb3f7b40cc8fa229fbd52b16934aab388a7
MD = b31ad3cd02b10db282b3576c059b746fb24ca6f09fef69402dc90ece7421cbb7
Len = 272
Msg = b12db4a1025529b3b7b1e45c6dbc7baa8897a0576e66f64bf3f8236113a6276ee77d
MD = 1c38bf6bbfd32292d67d1d651fd9d5b623b6ec1e854406223f51d0df46968712
Len = 280
Msg = e68cb6d8c1866c0a71e7313f83dc11a5809cf5cfbeed1a587ce9c2c92e022abc1644bb
MD = c2684c0dbb85c232b6da4fb5147dd0624429ec7e657991edd95eda37a587269e
Len = 288
Msg = 4e3d8ac36d61d9e51480831155b253b37969fe7ef49db3b39926f3a00b69a36774366000
MD = bf9d5e5b5393053f055b380baed7e792ae85ad37c0ada5fd4519542ccc461cf3
Len = 296
Msg = 03b264be51e4b941864f9b70b4c958f5355aac294b4b87cb037f11f85f07eb57b3f0b89550
MD = d1f8bd684001ac5a4b67bbf79f87de524d2da99ac014dec3e4187728f4557471
Len = 304
Msg = d0fefd96787c65ffa7f910d6d0ada63d64d5c4679960e7f06aeb8c70dfef954f8e39efdb629b
MD = 49ba38db85c2796f85ffd57dd5ec337007414528ae33935b102d16a6b91ba6c1
Len = 312
Msg = b7c79d7e5f1eeccdfedf0e7bf43e730d447e607d8d1489823d09e11201a0b1258039e7bd4875b1
MD = 725e6f8d888ebaf908b7692259ab8839c3248edd22ca115bb13e025808654700
Len = 320
Msg = 64cd363ecce05fdfda2486d011a3db95b5206a19d3054046819dd0d36783955d7e5bf8ba18bf738a
MD = 32caef024f84e97c30b4a7b9d04b678b3d8a6eb2259dff5b7f7c011f090845f8
Len = 328
Msg = 6ac6c63d618eaf00d91c5e2807e83c093912b8e202f78e139703498a79c6067f54497c6127a23910a6
MD = 4bb33e7c6916e08a9b3ed6bcef790aaaee0dcf2e7a01afb056182dea2dad7d63
Len = 336
Msg = d26826db9baeaa892691b68900b96163208e806a1da077429e454fa011840951a031327e605ab82ecce2
MD = 3ac7ac6bed82fdc8cd15b746f0ee7489158192c238f371c1883c9fe90b3e2831
Len = 344
Msg = 3f7a059b65d6cb0249204aac10b9f1a4ac9e5868adebbe935a9eb5b9019e1c938bfc4e5c5378997a3947f2
MD = bfce809534eefe871273964d32f091fe756c71a7f512ef5f2300bcd57f699e74
Len = 352
Msg = 60ffcb23d6b88e485b920af81d1083f6291d06ac8ca3a965b85914bc2add40544a027fca936bbde8f359051c
MD = 1d26f3e04f89b4eaa9dbed9231bb051eef2e8311ad26fe53d0bf0b821eaf7567
Len = 360
Msg = 9ecd07b684bb9e0e6692e320cec4510ca79fcdb3a2212c26d90df65db33e692d073cc174840db797504e482eef
MD = 0ffeb644a49e787ccc6970fe29705a4f4c2bfcfe7d19741c158333ff6982cc9c
Len = 368
Msg = 9d64de7161895884e7fa3d6e9eb996e7ebe511b01fe19cd4a6b3322e80aaf52bf6447ed1854e71001f4d54f8931d
MD = d048ee1524014adf9a56e60a388277de194c694cc787fc5a1b554ea9f07abfdf
Len = 376
Msg = c4ad3c5e78d917ecb0cbbcd1c481fc2aaf232f7e289779f40e504cc309662ee96fecbd20647ef00e46199fbc482f46
MD = 50dbf40066f8d270484ee2ef6632282dfa300a85a8530eceeb0e04275e1c1efd
Len = 384
Msg = 4eef5107459bddf8f24fc7656fd4896da8711db50400c0164847f692b886ce8d7f4d67395090b3534efd7b0d298da34b
MD = 7c5d14ed83dab875ac25ce7feed6ef837d58e79dc601fb3c1fca48d4464e8b83
Len = 392
Msg = 047d2758e7c2c9623f9bdb93b6597c5e84a0cd34e610014bcb25b49ed05c7e356e98c7a672c3dddcaeb84317ef614d342f
MD = 7d53eccd03da37bf58c1962a8f0f708a5c5c447f6a7e9e26137c169d5bdd82e4
Len = 400
Msg = 3d83df37172c81afd0de115139fbf4390c22e098c5af4c5ab4852406510bc0e6cf741769f44430c5270fdae0cb849d71cbab
MD = 99dc772e91ea02d9e421d552d61901016b9fd4ad2df4a8212c1ec5ba13893ab2
Len = 408
Msg = 33fd9bc17e2b271fa04c6b93c0bdeae98654a7682d31d9b4dab7e6f32cd58f2f148a68fbe7a88c5ab1d88edccddeb30ab21e5e
MD = cefdae1a3d75e792e8698d5e71f177cc761314e9ad5df9602c6e60ae65c4c267
Len = 416
Msg = 77a879cfa11d7fcac7a8282cc38a43dcf37643cc909837213bd6fd95d956b219a1406cbe73c52cd56c600e55b75bc37ea69641bc
MD = c99d64fa4dadd4bc8a389531c68b4590c6df0b9099c4d583bc00889fb7b98008
Len = 424
Msg = 45a3e6b86527f20b4537f5af96cfc5ad8777a2dde6cf7511886c5590ece24fc61b226739d207dabfe32ba6efd9ff4cd5db1bd5ead3
MD = 4d12a849047c6acd4b2eee6be35fa9051b02d21d50d419543008c1d82c427072
Len = 432
Msg = 25362a4b9d74bde6128c4fdc672305900947bc3ada9d9d316ebcf1667ad4363189937251f149c72e064a48608d940b7574b17fefc0df
MD = f8e4ccab6c979229f6066cc0cb0cfa81bb21447c16c68773be7e558e9f9d798d
Len = 440
Msg = 3ebfb06db8c38d5ba037f1363e118550aad94606e26835a01af05078533cc25f2f39573c04b632f62f68c294ab31f2a3e2a1a0d8c2be51
MD = 6595a2ef537a69ba8583dfbf7f5bec0ab1f93ce4c8ee1916eff44a93af5749c4
Len = 448
Msg = 2d52447d1244d2ebc28650e7b05654bad35b3a68eedc7f8515306b496d75f3e73385dd1b002625024b81a02f2fd6dffb6e6d561cb7d0bd7a
MD = cfb88d6faf2de3a69d36195acec2e255e2af2b7d933997f348e09f6ce5758360
Len = 456
Msg = 4cace422e4a015a75492b3b3bbfbdf3758eaff4fe504b46a26c90dacc119fa9050f603d2b58b398cad6d6d9fa922a154d9e0bc4389968274b0
MD = 4d54b2d284a6794581224e08f675541c8feab6eefa3ac1cfe5da4e03e62f72e4
Len = 464
Msg = 8620b86fbcaace4ff3c2921b8466ddd7bacae07eefef693cf17762dcabb89a84010fc9a0fb76ce1c26593ad637a61253f224d1b14a05addccabe
MD = dba490256c9720c54c612a5bd1ef573cd51dc12b3e7bd8c6db2eabe0aacb846b
Len = 472
Msg = d1be3f13febafefc14414d9fb7f693db16dc1ae270c5b647d80da8583587c1ad8cb8cb01824324411ca5ace3ca22e179a4ff4986f3f21190f3d7f3
MD = 02804978eba6e1de65afdbc6a6091ed6b1ecee51e8bff40646a251de6678b7ef
Len = 480
Msg = f499cc3f6e3cf7c312ffdfba61b1260c37129c1afb391047193367b7b2edeb579253e51d62ba6d911e7b818ccae1553f6146ea780f78e2219f629309
MD = 0b66c8b4fefebc8dc7da0bbedc1114f228aa63c37d5c30e91ab500f3eadfcec5
Len = 488
Msg = 6dd6efd6f6caa63b729aa8186e308bc1bda06307c05a2c0ae5a3684e6e460811748690dc2b58775967cfcc645fd82064b1279fdca771803db9dca0ff53
MD = c464a7bf6d180de4f744bb2fe5dc27a3f681334ffd54a9814650e60260a478e3
Len = 496
Msg = 6511a2242ddb273178e19a82c57c85cb05a6887ff2014cf1a31cb9ba5df1695aadb25c22b3c5ed51c10d047d256b8e3442842ae4e6c525f8d7a5a944af2a
MD = d6859c0b5a0b66376a24f56b2ab104286ed0078634ba19112ace0d6d60a9c1ae
Len = 504
Msg = e2f76e97606a872e317439f1a03fcd92e632e5bd4e7cbc4e97f1afc19a16fde92d77cbe546416b51640cddb92af996534dfd81edb17c4424cf1ac4d75aceeb
MD = 18041bd4665083001fba8c5411d2d748e8abbfdcdfd9218cb02b68a78e7d4c23
Len = 512
Msg = 5a86b737eaea8ee976a0a24da63e7ed7eefad18a101c1211e2b3650c5187c2a8a650547208251f6d4237e661c7bf4c77f335390394c37fa1a9f9be836ac28509
MD = 42e61e174fbb3897d6dd6cef3dd2802fe67b331953b06114a65c772859dfc1aa
# CAVS 11.0
# "SHA-256 ShortMsg" information
# SHA-256 tests are configured for BYTE oriented implementations
# Generated on Tue Mar 15 08:23:38 2011
[L = 32]
Len = 0
Msg = 00
MD = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Len = 8
Msg = d3
MD = 28969cdfa74a12c82f3bad960b0b000aca2ac329deea5c2328ebc6f2ba9802c1
Len = 16
Msg = 11af
MD = 5ca7133fa735326081558ac312c620eeca9970d1e70a4b95533d956f072d1f98
Len = 24
Msg = b4190e
MD = dff2e73091f6c05e528896c4c831b9448653dc2ff043528f6769437bc7b975c2
Len = 32
Msg = 74ba2521
MD = b16aa56be3880d18cd41e68384cf1ec8c17680c45a02b1575dc1518923ae8b0e
Len = 40
Msg = c299209682
MD = f0887fe961c9cd3beab957e8222494abb969b1ce4c6557976df8b0f6d20e9166
Len = 48
Msg = e1dc724d5621
MD = eca0a060b489636225b4fa64d267dabbe44273067ac679f20820bddc6b6a90ac
Len = 56
Msg = 06e076f5a442d5
MD = 3fd877e27450e6bbd5d74bb82f9870c64c66e109418baa8e6bbcff355e287926
Len = 64
Msg = 5738c929c4f4ccb6
MD = 963bb88f27f512777aab6c8b1a02c70ec0ad651d428f870036e1917120fb48bf
Len = 72
Msg = 3334c58075d3f4139e
MD = 078da3d77ed43bd3037a433fd0341855023793f9afd08b4b08ea1e5597ceef20
Len = 80
Msg = 74cb9381d89f5aa73368
MD = 73d6fad1caaa75b43b21733561fd3958bdc555194a037c2addec19dc2d7a52bd
Len = 88
Msg = 76ed24a0f40a41221ebfcf
MD = 044cef802901932e46dc46b2545e6c99c0fc323a0ed99b081bda4216857f38ac
Len = 96
Msg = 9baf69cba317f422fe26a9a0
MD = fe56287cd657e4afc50dba7a3a54c2a6324b886becdcd1fae473b769e551a09b
Len = 104
Msg = 68511cdb2dbbf3530d7fb61cbc
MD = af53430466715e99a602fc9f5945719b04dd24267e6a98471f7a7869bd3b4313
Len = 112
Msg = af397a8b8dd73ab702ce8e53aa9f
MD = d189498a3463b18e846b8ab1b41583b0b7efc789dad8a7fb885bbf8fb5b45c5c
Len = 120
Msg = 294af4802e5e925eb1c6cc9c724f09
MD = dcbaf335360de853b9cddfdafb90fa75567d0d3d58af8db9d764113aef570125
Len = 128
Msg = 0a27847cdc98bd6f62220b046edd762b
MD = 80c25ec1600587e7f28b18b1b18e3cdc89928e39cab3bc25e4d4a4c139bcedc4
Len = 136
Msg = 1b503fb9a73b16ada3fcf1042623ae7610
MD = d5c30315f72ed05fe519a1bf75ab5fd0ffec5ac1acb0daf66b6b769598594509
Len = 144
Msg = 59eb45bbbeb054b0b97334d53580ce03f699
MD = 32c38c54189f2357e96bd77eb00c2b9c341ebebacc2945f97804f59a93238288
Len = 152
Msg = 58e5a3259cb0b6d12c83f723379e35fd298b60
MD = 9b5b37816de8fcdf3ec10b745428708df8f391c550ea6746b2cafe019c2b6ace
Len = 160
Msg = c1ef39cee58e78f6fcdc12e058b7f902acd1a93b
MD = 6dd52b0d8b48cc8146cebd0216fbf5f6ef7eeafc0ff2ff9d1422d6345555a142
Len = 168
Msg = 9cab7d7dcaec98cb3ac6c64dd5d4470d0b103a810c
MD = 44d34809fc60d1fcafa7f37b794d1d3a765dd0d23194ebbe340f013f0c39b613
Len = 176
Msg = ea157c02ebaf1b22de221b53f2353936d2359d1e1c97
MD = 9df5c16a3f580406f07d96149303d8c408869b32053b726cf3defd241e484957
Len = 184
Msg = da999bc1f9c7acff32828a73e672d0a492f6ee895c6867
MD = 672b54e43f41ee77584bdf8bf854d97b6252c918f7ea2d26bc4097ea53a88f10
Len = 192
Msg = 47991301156d1d977c0338efbcad41004133aefbca6bcf7e
MD = feeb4b2b59fec8fdb1e55194a493d8c871757b5723675e93d3ac034b380b7fc9
Len = 200
Msg = 2e7ea84da4bc4d7cfb463e3f2c8647057afff3fbececa1d200
MD = 76e3acbc718836f2df8ad2d0d2d76f0cfa5fea0986be918f10bcee730df441b9
Len = 208
Msg = 47c770eb4549b6eff6381d62e9beb464cd98d341cc1c09981a7a
MD = 6733809c73e53666c735b3bd3daf87ebc77c72756150a616a194108d71231272
Len = 216
Msg = ac4c26d8b43b8579d8f61c9807026e83e9b586e1159bd43b851937
MD = 0e6e3c143c3a5f7f38505ed6adc9b48c18edf6dedf11635f6e8f9ac73c39fe9e
Len = 224
Msg = 0777fc1e1ca47304c2e265692838109e26aab9e5c4ae4e8600df4b1f
MD = ffb4fc03e054f8ecbc31470fc023bedcd4a406b9dd56c71da1b660dcc4842c65
Len = 232
Msg = 1a57251c431d4e6c2e06d65246a296915071a531425ecf255989422a66
MD = c644612cd326b38b1c6813b1daded34448805aef317c35f548dfb4a0d74b8106
Len = 240
Msg = 9b245fdad9baeb890d9c0d0eff816efb4ca138610bc7d78cb1a801ed3273
MD = c0e29eeeb0d3a7707947e623cdc7d1899adc70dd7861205ea5e5813954fb7957
Len = 248
Msg = 95a765809caf30ada90ad6d61c2b4b30250df0a7ce23b7753c9187f4319ce2
MD = a4139b74b102cf1e2fce229a6cd84c87501f50afa4c80feacf7d8cf5ed94f042
Len = 256
Msg = 09fc1accc230a205e4a208e64a8f204291f581a12756392da4b8c0cf5ef02b95
MD = 4f44c1c7fbebb6f9601829f3897bfd650c56fa07844be76489076356ac1886a4
Len = 264
Msg = 0546f7b8682b5b95fd32385faf25854cb3f7b40cc8fa229fbd52b16934aab388a7
MD = b31ad3cd02b10db282b3576c059b746fb24ca6f09fef69402dc90ece7421cbb7
Len = 272
Msg = b12db4a1025529b3b7b1e45c6dbc7baa8897a0576e66f64bf3f8236113a6276ee77d
MD = 1c38bf6bbfd32292d67d1d651fd9d5b623b6ec1e854406223f51d0df46968712
Len = 280
Msg = e68cb6d8c1866c0a71e7313f83dc11a5809cf5cfbeed1a587ce9c2c92e022abc1644bb
MD = c2684c0dbb85c232b6da4fb5147dd0624429ec7e657991edd95eda37a587269e
Len = 288
Msg = 4e3d8ac36d61d9e51480831155b253b37969fe7ef49db3b39926f3a00b69a36774366000
MD = bf9d5e5b5393053f055b380baed7e792ae85ad37c0ada5fd4519542ccc461cf3
Len = 296
Msg = 03b264be51e4b941864f9b70b4c958f5355aac294b4b87cb037f11f85f07eb57b3f0b89550
MD = d1f8bd684001ac5a4b67bbf79f87de524d2da99ac014dec3e4187728f4557471
Len = 304
Msg = d0fefd96787c65ffa7f910d6d0ada63d64d5c4679960e7f06aeb8c70dfef954f8e39efdb629b
MD = 49ba38db85c2796f85ffd57dd5ec337007414528ae33935b102d16a6b91ba6c1
Len = 312
Msg = b7c79d7e5f1eeccdfedf0e7bf43e730d447e607d8d1489823d09e11201a0b1258039e7bd4875b1
MD = 725e6f8d888ebaf908b7692259ab8839c3248edd22ca115bb13e025808654700
Len = 320
Msg = 64cd363ecce05fdfda2486d011a3db95b5206a19d3054046819dd0d36783955d7e5bf8ba18bf738a
MD = 32caef024f84e97c30b4a7b9d04b678b3d8a6eb2259dff5b7f7c011f090845f8
Len = 328
Msg = 6ac6c63d618eaf00d91c5e2807e83c093912b8e202f78e139703498a79c6067f54497c6127a23910a6
MD = 4bb33e7c6916e08a9b3ed6bcef790aaaee0dcf2e7a01afb056182dea2dad7d63
Len = 336
Msg = d26826db9baeaa892691b68900b96163208e806a1da077429e454fa011840951a031327e605ab82ecce2
MD = 3ac7ac6bed82fdc8cd15b746f0ee7489158192c238f371c1883c9fe90b3e2831
Len = 344
Msg = 3f7a059b65d6cb0249204aac10b9f1a4ac9e5868adebbe935a9eb5b9019e1c938bfc4e5c5378997a3947f2
MD = bfce809534eefe871273964d32f091fe756c71a7f512ef5f2300bcd57f699e74
Len = 352
Msg = 60ffcb23d6b88e485b920af81d1083f6291d06ac8ca3a965b85914bc2add40544a027fca936bbde8f359051c
MD = 1d26f3e04f89b4eaa9dbed9231bb051eef2e8311ad26fe53d0bf0b821eaf7567
Len = 360
Msg = 9ecd07b684bb9e0e6692e320cec4510ca79fcdb3a2212c26d90df65db33e692d073cc174840db797504e482eef
MD = 0ffeb644a49e787ccc6970fe29705a4f4c2bfcfe7d19741c158333ff6982cc9c
Len = 368
Msg = 9d64de7161895884e7fa3d6e9eb996e7ebe511b01fe19cd4a6b3322e80aaf52bf6447ed1854e71001f4d54f8931d
MD = d048ee1524014adf9a56e60a388277de194c694cc787fc5a1b554ea9f07abfdf
Len = 376
Msg = c4ad3c5e78d917ecb0cbbcd1c481fc2aaf232f7e289779f40e504cc309662ee96fecbd20647ef00e46199fbc482f46
MD = 50dbf40066f8d270484ee2ef6632282dfa300a85a8530eceeb0e04275e1c1efd
Len = 384
Msg = 4eef5107459bddf8f24fc7656fd4896da8711db50400c0164847f692b886ce8d7f4d67395090b3534efd7b0d298da34b
MD = 7c5d14ed83dab875ac25ce7feed6ef837d58e79dc601fb3c1fca48d4464e8b83
Len = 392
Msg = 047d2758e7c2c9623f9bdb93b6597c5e84a0cd34e610014bcb25b49ed05c7e356e98c7a672c3dddcaeb84317ef614d342f
MD = 7d53eccd03da37bf58c1962a8f0f708a5c5c447f6a7e9e26137c169d5bdd82e4
Len = 400
Msg = 3d83df37172c81afd0de115139fbf4390c22e098c5af4c5ab4852406510bc0e6cf741769f44430c5270fdae0cb849d71cbab
MD = 99dc772e91ea02d9e421d552d61901016b9fd4ad2df4a8212c1ec5ba13893ab2
Len = 408
Msg = 33fd9bc17e2b271fa04c6b93c0bdeae98654a7682d31d9b4dab7e6f32cd58f2f148a68fbe7a88c5ab1d88edccddeb30ab21e5e
MD = cefdae1a3d75e792e8698d5e71f177cc761314e9ad5df9602c6e60ae65c4c267
Len = 416
Msg = 77a879cfa11d7fcac7a8282cc38a43dcf37643cc909837213bd6fd95d956b219a1406cbe73c52cd56c600e55b75bc37ea69641bc
MD = c99d64fa4dadd4bc8a389531c68b4590c6df0b9099c4d583bc00889fb7b98008
Len = 424
Msg = 45a3e6b86527f20b4537f5af96cfc5ad8777a2dde6cf7511886c5590ece24fc61b226739d207dabfe32ba6efd9ff4cd5db1bd5ead3
MD = 4d12a849047c6acd4b2eee6be35fa9051b02d21d50d419543008c1d82c427072
Len = 432
Msg = 25362a4b9d74bde6128c4fdc672305900947bc3ada9d9d316ebcf1667ad4363189937251f149c72e064a48608d940b7574b17fefc0df
MD = f8e4ccab6c979229f6066cc0cb0cfa81bb21447c16c68773be7e558e9f9d798d
Len = 440
Msg = 3ebfb06db8c38d5ba037f1363e118550aad94606e26835a01af05078533cc25f2f39573c04b632f62f68c294ab31f2a3e2a1a0d8c2be51
MD = 6595a2ef537a69ba8583dfbf7f5bec0ab1f93ce4c8ee1916eff44a93af5749c4
Len = 448
Msg = 2d52447d1244d2ebc28650e7b05654bad35b3a68eedc7f8515306b496d75f3e73385dd1b002625024b81a02f2fd6dffb6e6d561cb7d0bd7a
MD = cfb88d6faf2de3a69d36195acec2e255e2af2b7d933997f348e09f6ce5758360
Len = 456
Msg = 4cace422e4a015a75492b3b3bbfbdf3758eaff4fe504b46a26c90dacc119fa9050f603d2b58b398cad6d6d9fa922a154d9e0bc4389968274b0
MD = 4d54b2d284a6794581224e08f675541c8feab6eefa3ac1cfe5da4e03e62f72e4
Len = 464
Msg = 8620b86fbcaace4ff3c2921b8466ddd7bacae07eefef693cf17762dcabb89a84010fc9a0fb76ce1c26593ad637a61253f224d1b14a05addccabe
MD = dba490256c9720c54c612a5bd1ef573cd51dc12b3e7bd8c6db2eabe0aacb846b
Len = 472
Msg = d1be3f13febafefc14414d9fb7f693db16dc1ae270c5b647d80da8583587c1ad8cb8cb01824324411ca5ace3ca22e179a4ff4986f3f21190f3d7f3
MD = 02804978eba6e1de65afdbc6a6091ed6b1ecee51e8bff40646a251de6678b7ef
Len = 480
Msg = f499cc3f6e3cf7c312ffdfba61b1260c37129c1afb391047193367b7b2edeb579253e51d62ba6d911e7b818ccae1553f6146ea780f78e2219f629309
MD = 0b66c8b4fefebc8dc7da0bbedc1114f228aa63c37d5c30e91ab500f3eadfcec5
Len = 488
Msg = 6dd6efd6f6caa63b729aa8186e308bc1bda06307c05a2c0ae5a3684e6e460811748690dc2b58775967cfcc645fd82064b1279fdca771803db9dca0ff53
MD = c464a7bf6d180de4f744bb2fe5dc27a3f681334ffd54a9814650e60260a478e3
Len = 496
Msg = 6511a2242ddb273178e19a82c57c85cb05a6887ff2014cf1a31cb9ba5df1695aadb25c22b3c5ed51c10d047d256b8e3442842ae4e6c525f8d7a5a944af2a
MD = d6859c0b5a0b66376a24f56b2ab104286ed0078634ba19112ace0d6d60a9c1ae
Len = 504
Msg = e2f76e97606a872e317439f1a03fcd92e632e5bd4e7cbc4e97f1afc19a16fde92d77cbe546416b51640cddb92af996534dfd81edb17c4424cf1ac4d75aceeb
MD = 18041bd4665083001fba8c5411d2d748e8abbfdcdfd9218cb02b68a78e7d4c23
Len = 512
Msg = 5a86b737eaea8ee976a0a24da63e7ed7eefad18a101c1211e2b3650c5187c2a8a650547208251f6d4237e661c7bf4c77f335390394c37fa1a9f9be836ac28509
MD = 42e61e174fbb3897d6dd6cef3dd2802fe67b331953b06114a65c772859dfc1aa

File diff suppressed because one or more lines are too long

View File

@ -1,309 +1,309 @@
# CAVS 11.1
# "SHA-384 Monte" information for "sha_values"
# SHA-384 tests are configured for BYTE oriented implementations
# Generated on Wed May 11 17:26:04 2011
[L = 48]
Seed = edff07255c71b54a9beae52cdfa083569a08be89949cbba73ddc8acf429359ca5e5be7a673633ca0d9709848f522a9df
COUNT = 0
MD = e81b86c49a38feddfd185f71ca7da6732a053ed4a2640d52d27f53f9f76422650b0e93645301ac99f8295d6f820f1035
COUNT = 1
MD = 1d6bd21713bffd50946a10c39a7742d740e8f271f0c8f643d4c95375094fd9bf29d89ee61a76053f22e44a4b058a64ed
COUNT = 2
MD = 425167b66ae965bd7d68515b54ebfa16f33d2bdb2147a4eac515a75224cd19cea564d692017d2a1c41c1a3f68bb5a209
COUNT = 3
MD = 9e7477ffd4baad1fcca035f4687b35ed47a57832fb27d131eb8018fcb41edf4d5e25874466d2e2d61ae3accdfc7aa364
COUNT = 4
MD = d7b4d4e779ca70c8d065630db1f9128ee43b4bde08a81bce13d48659b6ef47b6cfc802af6d8756f6cd43c709bb445bab
COUNT = 5
MD = a038eaa91772d458a7339612f6a9214e6550f78d5870d91fa7a3dc1c2321e511759c159a371475dda7ad1fd7f51ac82b
COUNT = 6
MD = 8552b4ea2da9f855fcc7230ac88ecb1c3cb4841cc28e0495bf1ab97d100d4e4c60a1c51949d26723415f560da2951bb0
COUNT = 7
MD = 668338b2e661d9e25b799d7329e55629b62416ee4d42d2e55245ffe7092e7ae4a3da6903944d532c2a88e4632f9a4b36
COUNT = 8
MD = c40cd19cb770b1fe81135fcb9223ffb9ef50340d13660658ba60656a88f4ea08ee3b572680e2b4abbaf4392486ea589a
COUNT = 9
MD = 540c154e82b57914abc0452990abf988e46a2f65b40f5e9ef80a38c7431293d5efa31c7c83df5345b079ad4e31b2c8b2
COUNT = 10
MD = e112f9359983e7df9b266f53ec950ed2b951b6d832c8fc1ffed22b4be3eae3d015e0771e96d344672000d4959d2829ab
COUNT = 11
MD = 186e69c28033e11b152542c86a94f59a25ec4edb7ab5b735faff16bdbacc682b2ae79b5f5a68ece9fee5ea4530b8a8f4
COUNT = 12
MD = a37c790e641f911ef2929bab0ccbb890627c7e38e1a2fbbd71cd4215de919763c2819c35a0e93984b7d85d0e8858573f
COUNT = 13
MD = f1b4bdcfe0cce284ca26e0b7e01f26de21bf4a7a409ee99fee1019cc8d23e775bc134ec7987a6575fa64160b5c7f849e
COUNT = 14
MD = 45aabfb784a29d6be30104ae9f3c5daa58e48a9c94f61fed94dccd2ec06b527ed564643573d588ce10d3847361a57961
COUNT = 15
MD = be3a49139a48dafba418bb9e0e8e2bd195e0d239eec77c43d1f0cee844b65f65c30cddfc05b644f9a792459695883a2e
COUNT = 16
MD = 3b263277a0d11de4cb4616591d4623e0821da4f111dae33938329cb8cc47f46742c70c09463edb9ff4a0171c4604b243
COUNT = 17
MD = 2be323079381bd13a02cca824c2f3cd18cbc89b0c3319afbf33c6f06f2abf2fa3af35ea9752ffe153d1775a95e7accbd
COUNT = 18
MD = 14c8c3ea3f5aea2e74a2f138863accf1b5f563d96194c0dcf08ca816e1ac9156c3f5d15aa5701d93c188c2c1f7237518
COUNT = 19
MD = b9158943803c47678fefafa91c98966aa3dc1fd96f4e86cfdde7ca879dbf9fa9f54b1988a53376f7005df7fd87b1396b
COUNT = 20
MD = f4395f88c4dc24b6edca5868fcebd24991ced2e3826c04ec00e4630d7e1f70ee56124a90657a795f446f7db94d8b439e
COUNT = 21
MD = bb56b4ed4683fce0d6d412ef84b7985ccc5fe30306679a994c8221c1212ff7f1492512095b7ddd250411008ce9d54020
COUNT = 22
MD = cacaeb081a62a4e384e0082f8b994dcd721f38b3c3e4b5836ddcaaab74bcf2700fdc8b6faf3f4df1ec175a0628728a4c
COUNT = 23
MD = 231796f44eba3c8c6ad064b0e350093fcae026c3c03d669c28e5f36befa5f35489bf595a0312c38b9b73b7bb4dad5b96
COUNT = 24
MD = d54559e7eb20534025f8f265bdbdab0e7dd9e2459305288d3ca84190b6d2c6e8ae2cd6f3e51ccb54551d94e9e40b31ac
COUNT = 25
MD = d6231b809b70ed19478cdf7e05534e92ea01e74e970fe17e92ec9a67b1b7977c4c485cfa74787224fe326b1b8d1ede87
COUNT = 26
MD = 8ca1d462cc1b16b734c0e4f1a6b7f7d9d0ba9ce8074addc7755243b05fe269afab6618f07fe73089d9379bcbdce6c728
COUNT = 27
MD = 60fa725bbf21ee56545ab24e6f26ec5ec749c4971bf761923c23415cbcb0c02e6a474deb50144abad2b0f16ddbe850a9
COUNT = 28
MD = 8b60fe287f5bc133ff842a246bf161a58b4b8ead5be073c702552d664653e384e28e70d28624aa1da951ed33dcdfc7fd
COUNT = 29
MD = d18a080af3ae7e6318dc69298bd7b13644b7ab00adac18b446c1e9a9366e68dade87687b9129aefae9a98b531309f1c7
COUNT = 30
MD = faad832a7ce865cf3183e51e07f08aad6570795f8d0274fae52fc5cb637ce4b7cdb8f8092e2ac4a7c96beb70cb288b69
COUNT = 31
MD = b7bea61748495351409fcf1bd45a94af34e7dd899933ed06d5759fe728f6933781c21f1986b99906c6910d976a0d9c4b
COUNT = 32
MD = b35027199cf6467302a88e5d0106d01953b41dfa172234b3e11d3ccad33bda9a836e44f43ae94451e2bea28f0dca7989
COUNT = 33
MD = 8571acd0d5fdd20909e9cd74e125cb9cd65a2e74056eab3f85f6f13e31a5fc1580aa588997d31a0a3ba1a16dea5528d3
COUNT = 34
MD = 3dcf49cb8d79d4ca3f6e06e8a58bb92a7a42d7915b9e710a29d37ece6c1c32eb89a897e9935354db3cbe384a1149964a
COUNT = 35
MD = 7b2258c5fbf26780f55054b4aa462a607eecbf7382af941efd75b9b4cadd5b97936a762b9c03e133d7cfb65de501e6df
COUNT = 36
MD = c54cfebd2381621fed5cf6b82b3dea25965ec99365ce415b184ded71b949eb8009d91c85c02b30b7465fdcf18be885ca
COUNT = 37
MD = 39bed6de0e885dfd51569f3c5dc967f7f551065e87b6e7108d15ef5ea407419f936f5ae2288aeecf98777249f384fdfa
COUNT = 38
MD = b1c341b1428e5df6f4bcec533f1b5ca57e02102f5647b82be0986e523fad24b7f27aa29336a3f333817e8a5336a4a3b4
COUNT = 39
MD = 2e1e67546b9424a2f0bd8931082f9fb8951b9fe57a2b61683a5e197017ebcd96592dc47a75d2ae4ab8f436edd5e5bb4e
COUNT = 40
MD = 6c84a39bc94af5960715818bf9b4694548dd1f0af8f6344d56b0dc7f86b181d5249172c82572ec8748ff35b6c0a2abd5
COUNT = 41
MD = 576705bec035d07e31ebb091f180cd68c3873ea306708c5259f50491463c68d912080ba9f11bcc983a4b849ca19df008
COUNT = 42
MD = d45c7e9080b6223a2185c490363764f9fb0634f3865d57a15bea438fb243e98fccad4176bf24c4cb7247dd2c5728b761
COUNT = 43
MD = b3021cedd2ba38b69348867729cfe2ab172e4f1643eb4971cde2db002413458a566ea884d651a9c010b1a6b869168497
COUNT = 44
MD = 1cb9c05e35029fe6b114c85a457091b7d9aaf7c95f32447f3f20cd034bc54f87ae85c4013d18fe2a94de8ecf9c6b9f05
COUNT = 45
MD = 1e8f037fb920b836b8f36a1ed4875cf7d61390f68d4843e420b2c1ca702a104524c1187c8eec7bb4b174a252e1ae1462
COUNT = 46
MD = 07c790c3d4948347ad5fad9992d8a0f6603a2133d138f1ff5cbbdc04c39277fb67d45b2e2c8e6c51fdaa6c5883e3a69c
COUNT = 47
MD = 98ef381d9b6b4e26ebf2bc293743e1e07943a3663b17f1be52d12ef8d19621263efb8525506ef6b95f746567a43577c6
COUNT = 48
MD = 8beefea2f858f8902928dae6060b10cf6d4a3cd1f91cf1ee5ddef0ee5fc25a8269367c114c1c5c5ab5287c48edc59274
COUNT = 49
MD = 03a6509ad6eb7f009931e596f3dab586de3bd6549afab4f218eba4fe47daf37c6faa360afdd931c5a95544f1a028195b
COUNT = 50
MD = bdf7e8d538e7ef418c808bf2dec1242b716326f83bf0a53db81f4d63aba37a2412f6b2bf00957ad6faf8404e4e2067a8
COUNT = 51
MD = 71ad43312ed6e403a5e174480fb14b3c2a3a60bba36611e1c99adf8013d243fe945b947b362b6dc51a3dd96235472f5e
COUNT = 52
MD = bec45a229217e5fe28d6d1675dc7440ccb5616c0f02eb5d4c814921fc82fdddb04592ce7af192fee6c61b1a08f6ab6aa
COUNT = 53
MD = 5d6bc2d2cd0d8f5e41656f73a473bef1eff212fe98b184386cdecade24c5c5e7b92cf76ea16f582b9951634881f85585
COUNT = 54
MD = 96e3568d30a1f7810404f3be8d2d26e5606da6c3fc064d0ef62298ca327476d587a1e3ef0d6554f4ad529053b7a651fd
COUNT = 55
MD = e4df3b7028f5e68753c1f21a556d8468a5d80fb048f6b92d405e519ea9ce44c6c95fb362119c553f5921dc9616dd3937
COUNT = 56
MD = 7881e36eef708df4d9c06e37bfa7af5ce7d41d31a2e4332d23922a518de3e2e6fd4b9f27ee64379afae7ca2570d24748
COUNT = 57
MD = aa12548b63d3a58f6914744111292cfc1f1358f717f1b19fab1a4ecac6292f1ff4b4c67b8a260b048f00ddc83b42453a
COUNT = 58
MD = b421b6941b5d7748765a4090c224dbbd98e85dcff9a65a77db0c2a83b92f4cad961b5b8ff76b5513d4a7af45ec4d4550
COUNT = 59
MD = 14e1b1733b16899c4046a604f8e1e777d55649c5357d7d9e3d7a1c395b6275aecf733a598de1d0bfd7eeaa9ecbd7d1e7
COUNT = 60
MD = bd05a1f9fa5b77371005a8073f0f3bcc4cb4e08fde3335dd3688921cf9cb5e97cf1b3052ff74bed8a359d170d2bea48f
COUNT = 61
MD = a319d9b3eeee6da494940ffb08903bcd588b18733a64ed435eadc5d9add6ab4f0c35fc050958bed81303409f388a065e
COUNT = 62
MD = 6f19824ec874b55e88fe4b1387433dab85415148870bf4a0612aa9c1cbcd9627925616fcdb66d68760c50fb308f628b0
COUNT = 63
MD = bacb435a1ff538d0ba3e3d0ab04b5e8868bc1f84e964409229d7eada4b846b813c0e30d8e962786aa83aac2dacf02d19
COUNT = 64
MD = e8f013470eafd5af84f63d51d51af2ca884789d03d79f8c3089810254b95a6f54fb86c08202cae94681ad702ea29451a
COUNT = 65
MD = 374b07621c018cc3935374c2f2f098e661ca0656181f67f55fb80ac36e23da379c4f6c8a3683c2621f874afa1241b918
COUNT = 66
MD = 5878f1ebcbe60aa62a7b149bd181167e5898d08a3627a08c589436f007bfb82c040b26ea9944c6f0c9c4079b9b0e1ecf
COUNT = 67
MD = 05961b57507c99d0cb7dc24ae34eddde94ac484129de621edac5b001ac5c0b974d09d24f75504f3be1a3cd635c44bf71
COUNT = 68
MD = d961eb883eecbc083533fa5128695c8d28281fbac23308dd2f504eb079d2d311b973f1a52b45aa6275550e14477a8876
COUNT = 69
MD = a4557f990f4ccce585ba33453090f66af576f0a501d26667031f48f19538b820b84f870579efb554e7550f9f53fea5ea
COUNT = 70
MD = 82194c49f24084249567f0e8963c5f72a23bc20a8f522a6108f12abf95b7437ad93673860a953264838a09bb3968d0a9
COUNT = 71
MD = 371dc5573b145f2136eb854591ece253efebf8732d3898bea063fdc3889d07953ee646e533b214f8c2dd66f1355b03cf
COUNT = 72
MD = cfc4dcecc6103027232029dd9a19850a6f79b9004be7d70054d0af11c692affa44c537f7cd749f2b6317cafe1fa52fe4
COUNT = 73
MD = 9920b835400795bd3ed8ae0bc12417d58be8c5ffd6eed151ed738c3031e624c74fb85488953ac81c75f395cab74f1679
COUNT = 74
MD = 4a1b040fa38b5cee63f5d308b55502d2a017b349ead5172c288289f42ba9874d0d11c9ac43255580c428a99067495782
COUNT = 75
MD = 93c1cb94d0689301728165299057edd78ef48a6dc7654931ae2bf7ea5bc733f3b724f4c3081bc93ed61e7d739c38e137
COUNT = 76
MD = 8f2e6c868b224b3cd5ac80669da0ba1d7e799e85a124c9e81c6865ebab1c0481e4ed4957a8989902ec565169ac53b7b4
COUNT = 77
MD = df045c9302fba73f9f27ceb0fb70e6ca3897f410e81a2b8392489e40aa17f15ac59cf8d6893ab10bacd8b59704eab22b
COUNT = 78
MD = 8ab095f49aa7ebfcb8b1410f42c38fb1755a0560e3638b8b82c7a852e8bce8f4b780015e051dda0d2cbd6d6cb08e30c0
COUNT = 79
MD = d77fdff2f768188efa63a7e29d73b8ade14c1aeb12e77866a57ea12c81bf0b3e1421d1af57fccf91b2098ba02ffb4118
COUNT = 80
MD = fac5ee7450b3fd1ae2152f5d020680137f553a2c210c57290d058f330d11407593d74c9d3d9ac88bf4af44e023345168
COUNT = 81
MD = 39d0ee95db114925ed7ff1577a22eb3dedb8658ce31504bd0f9f8a8f11f90825587203f26c432d216918156ca931fc82
COUNT = 82
MD = 17d22080e8a9f589a80a5ca8291b0479c41351008dffff79ff522779c35ba0b09acc2dedde936b07e260451d35ce86a9
COUNT = 83
MD = 9d75befac42e6d4d544e70477f7581264b5f8dda988da0dc40ef32f85c31b709284aef5f4f0246d20a855eee9175948e
COUNT = 84
MD = 3985f0cbca4c25f624850580516184e3d75996d77f138839c7570b4539b90fae8e751d1cea642816abd7f9ebf9d86c8f
COUNT = 85
MD = 93cfd14ade34e50deeee23aa75a63a017b6974e23051117e7e6b56b4ddb88f917a5d88d3af2af27da8e63fe130502f8e
COUNT = 86
MD = 7ae513480491a9500fa9afb8f64b8914ffdbeece3b3103048e91f6510b64cdccc8273257e275e5b34ec14c4c4aff4405
COUNT = 87
MD = 2585bab1cd98d4b51a1475fbfbe3bca43da2a7be842c5667c98d3b62a9f05918108be94198d96c67388f83c2abebe498
COUNT = 88
MD = 32f67419616e11fea79e3baeee4524c58d09f0cfb42049cea70f9a4a74e0096df841a0cf5177e402dd5803f4b51c602c
COUNT = 89
MD = 9f4486d93c599e68e7463d07d5cc9d589ab3a7c3d4d3c2b2d1f81f65b5c85068331f4142215f337c3621d096eb36aa91
COUNT = 90
MD = e3399ed2ac93c6a4a6c88c11bd89655aac3e573493483c81631fd67dba3bb237d46f9e8ddab3a9fd78236296d00dfd79
COUNT = 91
MD = bd9d1de114afa5ffacfbeb488d4846d012aa6ef66ce09725ae7b15e680d719fc2447f308eeb8247ae8e91e34b5a21ea2
COUNT = 92
MD = e1c3511ed2ed26f770bf5212c7ec245ab2ba49e1c09edae2abad6a3ee41c9e25445f5e5317cf7c9c3c3f702ecd6778a5
COUNT = 93
MD = c363234d1a6272d081f351cd68ac90abea09d3eae3a4d64fae7fab251a252591cb34dc63fb10abcbc5460129464c868b
COUNT = 94
MD = 6e5f1531eb282a2911a64b72b043cfe43b527d4d557abb9a31a9a632cdf5b5e055317ecb72a517a025eb4286d6f00433
COUNT = 95
MD = 19c85253b3c703fee80a70bb2ac2ef836bf8e14464d2a17f35bd5e4f2b0b3a059a27891410950a9ce07197f5b306ae3f
COUNT = 96
MD = eec713a44cb778811795609610f2f9bfc9bba479e415746efe0dc530b6de66d73cb85b8698a8c0c2ef9344a2043b7a31
COUNT = 97
MD = b799577aab5e8898326ed88eb96de38a27e76280ce44c3f16e70a1f96543ee7020bc29913ea0b9a9b9d92ae201143e0b
COUNT = 98
MD = e4dcabf1e22134076a21ea7cf9be6e03b099be40efc2b3080b9ec358cb021623ad27d33129bc68fce3eaec6b25aa2329
COUNT = 99
MD = ccde4359f23e64579c5c0380df837ee950928aa82937a2d2ed33d216e707c46d847efa5ca52dcbda551145e164fbd594
# CAVS 11.1
# "SHA-384 Monte" information for "sha_values"
# SHA-384 tests are configured for BYTE oriented implementations
# Generated on Wed May 11 17:26:04 2011
[L = 48]
Seed = edff07255c71b54a9beae52cdfa083569a08be89949cbba73ddc8acf429359ca5e5be7a673633ca0d9709848f522a9df
COUNT = 0
MD = e81b86c49a38feddfd185f71ca7da6732a053ed4a2640d52d27f53f9f76422650b0e93645301ac99f8295d6f820f1035
COUNT = 1
MD = 1d6bd21713bffd50946a10c39a7742d740e8f271f0c8f643d4c95375094fd9bf29d89ee61a76053f22e44a4b058a64ed
COUNT = 2
MD = 425167b66ae965bd7d68515b54ebfa16f33d2bdb2147a4eac515a75224cd19cea564d692017d2a1c41c1a3f68bb5a209
COUNT = 3
MD = 9e7477ffd4baad1fcca035f4687b35ed47a57832fb27d131eb8018fcb41edf4d5e25874466d2e2d61ae3accdfc7aa364
COUNT = 4
MD = d7b4d4e779ca70c8d065630db1f9128ee43b4bde08a81bce13d48659b6ef47b6cfc802af6d8756f6cd43c709bb445bab
COUNT = 5
MD = a038eaa91772d458a7339612f6a9214e6550f78d5870d91fa7a3dc1c2321e511759c159a371475dda7ad1fd7f51ac82b
COUNT = 6
MD = 8552b4ea2da9f855fcc7230ac88ecb1c3cb4841cc28e0495bf1ab97d100d4e4c60a1c51949d26723415f560da2951bb0
COUNT = 7
MD = 668338b2e661d9e25b799d7329e55629b62416ee4d42d2e55245ffe7092e7ae4a3da6903944d532c2a88e4632f9a4b36
COUNT = 8
MD = c40cd19cb770b1fe81135fcb9223ffb9ef50340d13660658ba60656a88f4ea08ee3b572680e2b4abbaf4392486ea589a
COUNT = 9
MD = 540c154e82b57914abc0452990abf988e46a2f65b40f5e9ef80a38c7431293d5efa31c7c83df5345b079ad4e31b2c8b2
COUNT = 10
MD = e112f9359983e7df9b266f53ec950ed2b951b6d832c8fc1ffed22b4be3eae3d015e0771e96d344672000d4959d2829ab
COUNT = 11
MD = 186e69c28033e11b152542c86a94f59a25ec4edb7ab5b735faff16bdbacc682b2ae79b5f5a68ece9fee5ea4530b8a8f4
COUNT = 12
MD = a37c790e641f911ef2929bab0ccbb890627c7e38e1a2fbbd71cd4215de919763c2819c35a0e93984b7d85d0e8858573f
COUNT = 13
MD = f1b4bdcfe0cce284ca26e0b7e01f26de21bf4a7a409ee99fee1019cc8d23e775bc134ec7987a6575fa64160b5c7f849e
COUNT = 14
MD = 45aabfb784a29d6be30104ae9f3c5daa58e48a9c94f61fed94dccd2ec06b527ed564643573d588ce10d3847361a57961
COUNT = 15
MD = be3a49139a48dafba418bb9e0e8e2bd195e0d239eec77c43d1f0cee844b65f65c30cddfc05b644f9a792459695883a2e
COUNT = 16
MD = 3b263277a0d11de4cb4616591d4623e0821da4f111dae33938329cb8cc47f46742c70c09463edb9ff4a0171c4604b243
COUNT = 17
MD = 2be323079381bd13a02cca824c2f3cd18cbc89b0c3319afbf33c6f06f2abf2fa3af35ea9752ffe153d1775a95e7accbd
COUNT = 18
MD = 14c8c3ea3f5aea2e74a2f138863accf1b5f563d96194c0dcf08ca816e1ac9156c3f5d15aa5701d93c188c2c1f7237518
COUNT = 19
MD = b9158943803c47678fefafa91c98966aa3dc1fd96f4e86cfdde7ca879dbf9fa9f54b1988a53376f7005df7fd87b1396b
COUNT = 20
MD = f4395f88c4dc24b6edca5868fcebd24991ced2e3826c04ec00e4630d7e1f70ee56124a90657a795f446f7db94d8b439e
COUNT = 21
MD = bb56b4ed4683fce0d6d412ef84b7985ccc5fe30306679a994c8221c1212ff7f1492512095b7ddd250411008ce9d54020
COUNT = 22
MD = cacaeb081a62a4e384e0082f8b994dcd721f38b3c3e4b5836ddcaaab74bcf2700fdc8b6faf3f4df1ec175a0628728a4c
COUNT = 23
MD = 231796f44eba3c8c6ad064b0e350093fcae026c3c03d669c28e5f36befa5f35489bf595a0312c38b9b73b7bb4dad5b96
COUNT = 24
MD = d54559e7eb20534025f8f265bdbdab0e7dd9e2459305288d3ca84190b6d2c6e8ae2cd6f3e51ccb54551d94e9e40b31ac
COUNT = 25
MD = d6231b809b70ed19478cdf7e05534e92ea01e74e970fe17e92ec9a67b1b7977c4c485cfa74787224fe326b1b8d1ede87
COUNT = 26
MD = 8ca1d462cc1b16b734c0e4f1a6b7f7d9d0ba9ce8074addc7755243b05fe269afab6618f07fe73089d9379bcbdce6c728
COUNT = 27
MD = 60fa725bbf21ee56545ab24e6f26ec5ec749c4971bf761923c23415cbcb0c02e6a474deb50144abad2b0f16ddbe850a9
COUNT = 28
MD = 8b60fe287f5bc133ff842a246bf161a58b4b8ead5be073c702552d664653e384e28e70d28624aa1da951ed33dcdfc7fd
COUNT = 29
MD = d18a080af3ae7e6318dc69298bd7b13644b7ab00adac18b446c1e9a9366e68dade87687b9129aefae9a98b531309f1c7
COUNT = 30
MD = faad832a7ce865cf3183e51e07f08aad6570795f8d0274fae52fc5cb637ce4b7cdb8f8092e2ac4a7c96beb70cb288b69
COUNT = 31
MD = b7bea61748495351409fcf1bd45a94af34e7dd899933ed06d5759fe728f6933781c21f1986b99906c6910d976a0d9c4b
COUNT = 32
MD = b35027199cf6467302a88e5d0106d01953b41dfa172234b3e11d3ccad33bda9a836e44f43ae94451e2bea28f0dca7989
COUNT = 33
MD = 8571acd0d5fdd20909e9cd74e125cb9cd65a2e74056eab3f85f6f13e31a5fc1580aa588997d31a0a3ba1a16dea5528d3
COUNT = 34
MD = 3dcf49cb8d79d4ca3f6e06e8a58bb92a7a42d7915b9e710a29d37ece6c1c32eb89a897e9935354db3cbe384a1149964a
COUNT = 35
MD = 7b2258c5fbf26780f55054b4aa462a607eecbf7382af941efd75b9b4cadd5b97936a762b9c03e133d7cfb65de501e6df
COUNT = 36
MD = c54cfebd2381621fed5cf6b82b3dea25965ec99365ce415b184ded71b949eb8009d91c85c02b30b7465fdcf18be885ca
COUNT = 37
MD = 39bed6de0e885dfd51569f3c5dc967f7f551065e87b6e7108d15ef5ea407419f936f5ae2288aeecf98777249f384fdfa
COUNT = 38
MD = b1c341b1428e5df6f4bcec533f1b5ca57e02102f5647b82be0986e523fad24b7f27aa29336a3f333817e8a5336a4a3b4
COUNT = 39
MD = 2e1e67546b9424a2f0bd8931082f9fb8951b9fe57a2b61683a5e197017ebcd96592dc47a75d2ae4ab8f436edd5e5bb4e
COUNT = 40
MD = 6c84a39bc94af5960715818bf9b4694548dd1f0af8f6344d56b0dc7f86b181d5249172c82572ec8748ff35b6c0a2abd5
COUNT = 41
MD = 576705bec035d07e31ebb091f180cd68c3873ea306708c5259f50491463c68d912080ba9f11bcc983a4b849ca19df008
COUNT = 42
MD = d45c7e9080b6223a2185c490363764f9fb0634f3865d57a15bea438fb243e98fccad4176bf24c4cb7247dd2c5728b761
COUNT = 43
MD = b3021cedd2ba38b69348867729cfe2ab172e4f1643eb4971cde2db002413458a566ea884d651a9c010b1a6b869168497
COUNT = 44
MD = 1cb9c05e35029fe6b114c85a457091b7d9aaf7c95f32447f3f20cd034bc54f87ae85c4013d18fe2a94de8ecf9c6b9f05
COUNT = 45
MD = 1e8f037fb920b836b8f36a1ed4875cf7d61390f68d4843e420b2c1ca702a104524c1187c8eec7bb4b174a252e1ae1462
COUNT = 46
MD = 07c790c3d4948347ad5fad9992d8a0f6603a2133d138f1ff5cbbdc04c39277fb67d45b2e2c8e6c51fdaa6c5883e3a69c
COUNT = 47
MD = 98ef381d9b6b4e26ebf2bc293743e1e07943a3663b17f1be52d12ef8d19621263efb8525506ef6b95f746567a43577c6
COUNT = 48
MD = 8beefea2f858f8902928dae6060b10cf6d4a3cd1f91cf1ee5ddef0ee5fc25a8269367c114c1c5c5ab5287c48edc59274
COUNT = 49
MD = 03a6509ad6eb7f009931e596f3dab586de3bd6549afab4f218eba4fe47daf37c6faa360afdd931c5a95544f1a028195b
COUNT = 50
MD = bdf7e8d538e7ef418c808bf2dec1242b716326f83bf0a53db81f4d63aba37a2412f6b2bf00957ad6faf8404e4e2067a8
COUNT = 51
MD = 71ad43312ed6e403a5e174480fb14b3c2a3a60bba36611e1c99adf8013d243fe945b947b362b6dc51a3dd96235472f5e
COUNT = 52
MD = bec45a229217e5fe28d6d1675dc7440ccb5616c0f02eb5d4c814921fc82fdddb04592ce7af192fee6c61b1a08f6ab6aa
COUNT = 53
MD = 5d6bc2d2cd0d8f5e41656f73a473bef1eff212fe98b184386cdecade24c5c5e7b92cf76ea16f582b9951634881f85585
COUNT = 54
MD = 96e3568d30a1f7810404f3be8d2d26e5606da6c3fc064d0ef62298ca327476d587a1e3ef0d6554f4ad529053b7a651fd
COUNT = 55
MD = e4df3b7028f5e68753c1f21a556d8468a5d80fb048f6b92d405e519ea9ce44c6c95fb362119c553f5921dc9616dd3937
COUNT = 56
MD = 7881e36eef708df4d9c06e37bfa7af5ce7d41d31a2e4332d23922a518de3e2e6fd4b9f27ee64379afae7ca2570d24748
COUNT = 57
MD = aa12548b63d3a58f6914744111292cfc1f1358f717f1b19fab1a4ecac6292f1ff4b4c67b8a260b048f00ddc83b42453a
COUNT = 58
MD = b421b6941b5d7748765a4090c224dbbd98e85dcff9a65a77db0c2a83b92f4cad961b5b8ff76b5513d4a7af45ec4d4550
COUNT = 59
MD = 14e1b1733b16899c4046a604f8e1e777d55649c5357d7d9e3d7a1c395b6275aecf733a598de1d0bfd7eeaa9ecbd7d1e7
COUNT = 60
MD = bd05a1f9fa5b77371005a8073f0f3bcc4cb4e08fde3335dd3688921cf9cb5e97cf1b3052ff74bed8a359d170d2bea48f
COUNT = 61
MD = a319d9b3eeee6da494940ffb08903bcd588b18733a64ed435eadc5d9add6ab4f0c35fc050958bed81303409f388a065e
COUNT = 62
MD = 6f19824ec874b55e88fe4b1387433dab85415148870bf4a0612aa9c1cbcd9627925616fcdb66d68760c50fb308f628b0
COUNT = 63
MD = bacb435a1ff538d0ba3e3d0ab04b5e8868bc1f84e964409229d7eada4b846b813c0e30d8e962786aa83aac2dacf02d19
COUNT = 64
MD = e8f013470eafd5af84f63d51d51af2ca884789d03d79f8c3089810254b95a6f54fb86c08202cae94681ad702ea29451a
COUNT = 65
MD = 374b07621c018cc3935374c2f2f098e661ca0656181f67f55fb80ac36e23da379c4f6c8a3683c2621f874afa1241b918
COUNT = 66
MD = 5878f1ebcbe60aa62a7b149bd181167e5898d08a3627a08c589436f007bfb82c040b26ea9944c6f0c9c4079b9b0e1ecf
COUNT = 67
MD = 05961b57507c99d0cb7dc24ae34eddde94ac484129de621edac5b001ac5c0b974d09d24f75504f3be1a3cd635c44bf71
COUNT = 68
MD = d961eb883eecbc083533fa5128695c8d28281fbac23308dd2f504eb079d2d311b973f1a52b45aa6275550e14477a8876
COUNT = 69
MD = a4557f990f4ccce585ba33453090f66af576f0a501d26667031f48f19538b820b84f870579efb554e7550f9f53fea5ea
COUNT = 70
MD = 82194c49f24084249567f0e8963c5f72a23bc20a8f522a6108f12abf95b7437ad93673860a953264838a09bb3968d0a9
COUNT = 71
MD = 371dc5573b145f2136eb854591ece253efebf8732d3898bea063fdc3889d07953ee646e533b214f8c2dd66f1355b03cf
COUNT = 72
MD = cfc4dcecc6103027232029dd9a19850a6f79b9004be7d70054d0af11c692affa44c537f7cd749f2b6317cafe1fa52fe4
COUNT = 73
MD = 9920b835400795bd3ed8ae0bc12417d58be8c5ffd6eed151ed738c3031e624c74fb85488953ac81c75f395cab74f1679
COUNT = 74
MD = 4a1b040fa38b5cee63f5d308b55502d2a017b349ead5172c288289f42ba9874d0d11c9ac43255580c428a99067495782
COUNT = 75
MD = 93c1cb94d0689301728165299057edd78ef48a6dc7654931ae2bf7ea5bc733f3b724f4c3081bc93ed61e7d739c38e137
COUNT = 76
MD = 8f2e6c868b224b3cd5ac80669da0ba1d7e799e85a124c9e81c6865ebab1c0481e4ed4957a8989902ec565169ac53b7b4
COUNT = 77
MD = df045c9302fba73f9f27ceb0fb70e6ca3897f410e81a2b8392489e40aa17f15ac59cf8d6893ab10bacd8b59704eab22b
COUNT = 78
MD = 8ab095f49aa7ebfcb8b1410f42c38fb1755a0560e3638b8b82c7a852e8bce8f4b780015e051dda0d2cbd6d6cb08e30c0
COUNT = 79
MD = d77fdff2f768188efa63a7e29d73b8ade14c1aeb12e77866a57ea12c81bf0b3e1421d1af57fccf91b2098ba02ffb4118
COUNT = 80
MD = fac5ee7450b3fd1ae2152f5d020680137f553a2c210c57290d058f330d11407593d74c9d3d9ac88bf4af44e023345168
COUNT = 81
MD = 39d0ee95db114925ed7ff1577a22eb3dedb8658ce31504bd0f9f8a8f11f90825587203f26c432d216918156ca931fc82
COUNT = 82
MD = 17d22080e8a9f589a80a5ca8291b0479c41351008dffff79ff522779c35ba0b09acc2dedde936b07e260451d35ce86a9
COUNT = 83
MD = 9d75befac42e6d4d544e70477f7581264b5f8dda988da0dc40ef32f85c31b709284aef5f4f0246d20a855eee9175948e
COUNT = 84
MD = 3985f0cbca4c25f624850580516184e3d75996d77f138839c7570b4539b90fae8e751d1cea642816abd7f9ebf9d86c8f
COUNT = 85
MD = 93cfd14ade34e50deeee23aa75a63a017b6974e23051117e7e6b56b4ddb88f917a5d88d3af2af27da8e63fe130502f8e
COUNT = 86
MD = 7ae513480491a9500fa9afb8f64b8914ffdbeece3b3103048e91f6510b64cdccc8273257e275e5b34ec14c4c4aff4405
COUNT = 87
MD = 2585bab1cd98d4b51a1475fbfbe3bca43da2a7be842c5667c98d3b62a9f05918108be94198d96c67388f83c2abebe498
COUNT = 88
MD = 32f67419616e11fea79e3baeee4524c58d09f0cfb42049cea70f9a4a74e0096df841a0cf5177e402dd5803f4b51c602c
COUNT = 89
MD = 9f4486d93c599e68e7463d07d5cc9d589ab3a7c3d4d3c2b2d1f81f65b5c85068331f4142215f337c3621d096eb36aa91
COUNT = 90
MD = e3399ed2ac93c6a4a6c88c11bd89655aac3e573493483c81631fd67dba3bb237d46f9e8ddab3a9fd78236296d00dfd79
COUNT = 91
MD = bd9d1de114afa5ffacfbeb488d4846d012aa6ef66ce09725ae7b15e680d719fc2447f308eeb8247ae8e91e34b5a21ea2
COUNT = 92
MD = e1c3511ed2ed26f770bf5212c7ec245ab2ba49e1c09edae2abad6a3ee41c9e25445f5e5317cf7c9c3c3f702ecd6778a5
COUNT = 93
MD = c363234d1a6272d081f351cd68ac90abea09d3eae3a4d64fae7fab251a252591cb34dc63fb10abcbc5460129464c868b
COUNT = 94
MD = 6e5f1531eb282a2911a64b72b043cfe43b527d4d557abb9a31a9a632cdf5b5e055317ecb72a517a025eb4286d6f00433
COUNT = 95
MD = 19c85253b3c703fee80a70bb2ac2ef836bf8e14464d2a17f35bd5e4f2b0b3a059a27891410950a9ce07197f5b306ae3f
COUNT = 96
MD = eec713a44cb778811795609610f2f9bfc9bba479e415746efe0dc530b6de66d73cb85b8698a8c0c2ef9344a2043b7a31
COUNT = 97
MD = b799577aab5e8898326ed88eb96de38a27e76280ce44c3f16e70a1f96543ee7020bc29913ea0b9a9b9d92ae201143e0b
COUNT = 98
MD = e4dcabf1e22134076a21ea7cf9be6e03b099be40efc2b3080b9ec358cb021623ad27d33129bc68fce3eaec6b25aa2329
COUNT = 99
MD = ccde4359f23e64579c5c0380df837ee950928aa82937a2d2ed33d216e707c46d847efa5ca52dcbda551145e164fbd594

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,309 +1,309 @@
# CAVS 11.1
# "SHA-512 Monte" information for "sha_values"
# SHA-512 tests are configured for BYTE oriented implementations
# Generated on Wed May 11 17:26:11 2011
[L = 64]
Seed = 5c337de5caf35d18ed90b5cddfce001ca1b8ee8602f367e7c24ccca6f893802fb1aca7a3dae32dcd60800a59959bc540d63237876b799229ae71a2526fbc52cd
COUNT = 0
MD = ada69add0071b794463c8806a177326735fa624b68ab7bcab2388b9276c036e4eaaff87333e83c81c0bca0359d4aeebcbcfd314c0630e0c2af68c1fb19cc470e
COUNT = 1
MD = ef219b37c24ae507a2b2b26d1add51b31fb5327eb8c3b19b882fe38049433dbeccd63b3d5b99ba2398920bcefb8aca98cd28a1ee5d2aaf139ce58a15d71b06b4
COUNT = 2
MD = c3d5087a62db0e5c6f5755c417f69037308cbce0e54519ea5be8171496cc6d18023ba15768153cfd74c7e7dc103227e9eed4b0f82233362b2a7b1a2cbcda9daf
COUNT = 3
MD = bb3a58f71148116e377505461d65d6c89906481fedfbcfe481b7aa8ceb977d252b3fe21bfff6e7fbf7575ceecf5936bd635e1cf52698c36ef6908ddbd5b6ae05
COUNT = 4
MD = b68f0cd2d63566b3934a50666dec6d62ca1db98e49d7733084c1f86d91a8a08c756fa7ece815e20930dd7cb66351bad8c087c2f94e8757cb98e7f4b86b21a8a8
COUNT = 5
MD = 937d7856a82a84c163c79417d0540c47daaf9ffe662c843737dbbcbe5f865bf6f47a9d2bd10129a4f498073094653c324a2519a1c71ac1279b1623ff7d24647a
COUNT = 6
MD = f8fbc058c2b9f84131c9decfa543a35ade41581f670398efd61b3abfced9c1cfcb5324f2370487f9c59a65bc668ea596c8d22ce8a33014dfad28357fa7d05f04
COUNT = 7
MD = 4ab0c9484ff5c30fa64ae6e81510c5fea566eafb88f175f8bc19109f40fe80014c8b77fff10b8750778429bf3c5497e4cb92d9b30014f4cb975dff2a45244c28
COUNT = 8
MD = 685179397554d276513d630234a03419808c698abf2600d7490aabb8e455c6ab6ea412c7729dc140a79dff66533c6946cbe90f9da9ed16e2e629db1651bea870
COUNT = 9
MD = 335e6e941ab7dadfecdb74ea6cb4e8584b6e3408841a33a6cf7fd6a63294b1930a60983240311672acac3840a90e64cc366ce75081b2252627e9c31197ebad03
COUNT = 10
MD = e3217f6af6e279e9445dc3738cbf9ba0e9edba0455844a73648139777afdea2c4d8032e214f541bf92675fb23f24df8e4fe98e0003aadfb6d8f9cc2cd799bbf7
COUNT = 11
MD = ee2fdfb3ae630613b7d890977cf2515deac272a37f27e4a01961ecf103d4ff5b45cc8aef53b635dd75aa51aabf71c0642555ccd3281e0388f8ca09d83258cf30
COUNT = 12
MD = 6a30d97cc98af6a25b673dce7aeab8d762bf2e55ea0c6dc899179281f84dd02a2896f77e9c106b472f55f7adbef7b1157be567ee1236ebdac2a3c5d8cb133eb5
COUNT = 13
MD = ac1176abdc5f71170183d92ae55856221b0d95590af11d9d72ba605ec026bbec52d6974bc43a1efb125ff2b161fbdc616fda00f04193a0bc26aacdfa052a5741
COUNT = 14
MD = 59fa909480620ecc08d34531a6da1b55158b74fc93ddf68e1d242615b6f3843a7952e63e798c6445cde1b07e0be09d0d711cb7b42a0e7760a593b08acfceb63d
COUNT = 15
MD = 9eb253319efa61b864f27bd334d7dd78b38d3265fb544e0c8edee950a547e1d8db921a285774ab94d66beae933298d20f2a5aa87c62fe1e383cc3b18e7af18ac
COUNT = 16
MD = 81735324005671f7bdad9e685ee8257f5e0622b9fcb5d38dbdfb2df27258c3e1d46d76e24c0c92c744e1b50a2b4b0d31525b3af83cc80a75722d921bdeef59c4
COUNT = 17
MD = 17498cdff4323bb8021e44eca6559e05d8ff9a0ef2ee9d4ba0ac6e73f83972a0dfbb6d47728fa70311d7c82e154966e1b7678263b0f65133e9116969193d429b
COUNT = 18
MD = 228c4574d7c45eb9ba9240722133fce74abe00c7328ab30b4bde373dc79afdd6e0569d36268cd5eaa2f27205fc00512577bcbb6699e1d66ed85eafaba7548afb
COUNT = 19
MD = 3d40ccd9cc445bbecca9227c67fe455d89e0b7c1c858d32f30e2b544ca9a5a606535aea2e59fec6ec4d1ba898cc4338c6eadef9c0884bcf56aca2f481a2d7d3e
COUNT = 20
MD = e1e577aeac92e3a2b7f8a262bf2ac9c037d2274ca6618fbe4cc21db7c699e9946b6671ae45ea433a1e392a5bc9eec96fd641ba8f4a047f022a04a337227004df
COUNT = 21
MD = 5e4424c0bcb2f0f7a2428821a9d5840a82401f4440ae6bed25c53cd9e71cf9d39904d6a375bd721f4332ab0202529c91feb9c094c3e6d34ca4f66649ee6fa212
COUNT = 22
MD = 56b199d63ca37189d5ca0d40006ac7bcb9f39cbdc00ef7b8a5697caa7d81d05b645a146995b1151d01958f1589337e14afc6e7dd10a815170e527a398e6ce8c3
COUNT = 23
MD = d2d498ff93fb03013a64f295b5bc68e57d2fb5600da578aa011d43ff432eae3e0c800f9e2a53155e56fdbf5e068fe2b4beb3e42b2585531b8b16c4d8ca3356c6
COUNT = 24
MD = 3d3875489903710f17cf4247b5842ace6f017b1a3b99e9ee5fbc04fc7898e78b12693879878028ca40c63cd0f6925fb7d0ca0412e4f06619e3ace223690f03b8
COUNT = 25
MD = a013e21cd1234483c95c2ea2757be949bc79401ba39b09c316a1612d594642be65ca106e12695ac3808c57c6f2980e895fd1fe188946562afc238414e1e43649
COUNT = 26
MD = c5f6367d7195489e16242f912fbe0d8002e947de3a7e9c53f77b1e5e90e05bd7ca395e787e34cb5f500c02da59c9d83de35601de7ae80dae74a0d6b4a292d43b
COUNT = 27
MD = 7c28c44c6aaba83c122f24d68273e28a5afd65b4071d02b7ea3300478d5118971e1356ae57cbc70d2a177ea464a1c2c50d4297b933e789c63b1481797ae8f08c
COUNT = 28
MD = af7cb42b1c70a85ac1ae1c2991b25b657c19f4fcf83af7f7dc0ae1028c1452a6a17dc98929634fe6ed3855b70b96bc2caa93d82037b94ebeddc77e4c1a7cc563
COUNT = 29
MD = bd56ad4c0cbd162706053da929d667253aadcf417affb483fff4f2699bf406d128cfdf5196dfbb05bb89ccbf04c5147bd2ebb3156b0bc1768ca6faa171c91c01
COUNT = 30
MD = 004d7b0fff9bcddf4b3913ae190a76728705a3d23874d92a8b7ff246c8fcad46623cb04723c8aded0cba4968d1a8cc1375b99005786c1bcb7ae4bf13325c3ae0
COUNT = 31
MD = 8299a5bf5ed64f525c4eebbeca969fc1b91a81adb58c584bdd2d7676386a31fa546643a3cf505007584f02fb712d708cab645bf078a1b9339f5a76aee985d017
COUNT = 32
MD = ce7100f3455db1a9776a9f40d562ea998afca1f9fee7e0d81c8db34cf68ad23a8bfa6fc04774703e1e56d5196b66966158fcf2a8335a58c6ba7ba1af756ba1dc
COUNT = 33
MD = 90aaabcb655ee921b8350229efe6064a60051cf0cac858fa3d43afd5b97cc82301bd1b8cc1f874022e5af948185638783a13ca1bbd5049ace7fbf4f6d90c201f
COUNT = 34
MD = 3cf0a25b33ded3e0806dfe603b9987f1d6f2b3fdcb1ec7f8566828c00e17e8f59e38b3bca302396c7525ca194e6cc8501369059e2e34ae21e3141215876847c4
COUNT = 35
MD = bdc5266aee339a1ff13fcf5229773cd3d14b47101e83076927c160bb71bf7445590525a2012d52af008e118e16df1b6bfcaf8f22b4e45f9e749f3c20625a2bc8
COUNT = 36
MD = ef8d2ba885381ab97756d59dbbbf53a1ea35d152b2d8f82c3518430aa34e708359194ea43950d032e151f576d343a5c3cfe6b71d4ed0ead9d3a107402589bad0
COUNT = 37
MD = 194ea5324c4179998dd7057755f255fdea04dadf533f7851e3e9718b610948e32fd28323077d9421142ac808978adfa325b668c8599a2e01c757a5a14ed2dd37
COUNT = 38
MD = 106984d2f0087e621dae760552bc6279072267883c204079481af6034354f1a2b77c17e6c039a1063e479342aa3ccd90330dd3fb5a7d5e976619497e2d3326cd
COUNT = 39
MD = a1347216f1a6db47b90c4ded3c5c75440f54c22c87d538314d1340f86f88acba01378acb933ddad0adc6b75d55bfb7e8efc9c4a531b2a410610b7515b6dac66a
COUNT = 40
MD = b76e4db147e0eaa4f04880654088b9d0fce518c8c377d92c846345604dc6b2b18d377fdb8e30f06d9bcfe6d7dacc07d6adff73d98d49f8f132b80f3084390830
COUNT = 41
MD = acd4e527763dfd4513f0def0b1edf8ea12dc78d336b7b796f3dcc32e1068725443a2f55ab4f666b27d6bf2ab39669c98293f0a9108051fd3144d31a1ed171ddd
COUNT = 42
MD = 10128c15494bc87a87374f676ef9fe2df20b36ffcca41a80bd40b216637b3de710efd070e277827820a7bba3cceb7b21f8fe7f9775d6c4df4d3da5349434ec49
COUNT = 43
MD = 2632dd5c188c6ed3a4610405fdda704add752f5424d9de65a51400fe478e26cd0412e5f91ca4b744c34f4954f40a3a4254431d21954623208b527b7b4daa687e
COUNT = 44
MD = 45707f5b6fc5ccd1f78d77f177d10fb8b462c74cc821518cd5cfa4b5d6b40b418044900693c37abbb82367d340fec67f800d74072935da1706b4d90ae26099c7
COUNT = 45
MD = 56c37f31220b5b3040373d91b2c5e42fe9e601a12f7f8dc4534459bf28e484b8713db243c5782c031e674003a3c14c42fd152e7188789065e82795e10f87d54b
COUNT = 46
MD = 5da94c899d48bd8299fee3d81662f8d6c5f8f8bc54d18cb0368b13cebaee7ad71e74ea80f34974ad166f04f9a0602809166fe4085a475a8ca86cade12b6754c4
COUNT = 47
MD = 0664363f97ba910760b0922e31ca880ca97469506cb007e3108c36c3ce3ce1801fb4197609479339e8820632b6a38bffffee05a9adc11cc544b9aa6f5b95cc6f
COUNT = 48
MD = 732c41a1edaa727c04f627ff158aaff67c18efd667216132b99ab84d108996a10bb008b5d803b22ed1aa78bb0d10f8a762fd34777d7dccce8e84827ba88d4193
COUNT = 49
MD = fc9c21d67e393a2b05a23a17d8db630cbaebaa3def211181749f1bcad181560627fb60ee20fae2e5980cbf50fce0a19dce807e7fb75c4da0ef008bc75d413a65
COUNT = 50
MD = 0453b765afc1edffa595efe345177f5805ed3abc1297ceab757ae7161723a6144cb543299f418049276d16b7896662631634fab9549127c10f27505b7dee8665
COUNT = 51
MD = 3853f3bf024e0668e8d1ea53733a97537f97d9307c5f3a19864ab4eeb1654710693bb961a344dec8a758f5e64b26fcb6dd423419c4a114fa749211a9de06c281
COUNT = 52
MD = 240137f0dd57beb3f7fc283bb3ead423c67883fd46f4e27471d7be57ad469a49bad03a3658418bd55614678f3a463bceff85291314b90ef43ccbcb028f0a7a07
COUNT = 53
MD = f9050a5271edbe4cfdb9520ec05bbdc3cbcb9bce36fd212338d3e7028a39b9ab30793e561d75a2e424193264c7f0775e65599ef0c94e0ad24dbfe18252364267
COUNT = 54
MD = 47caa7a5862fad837aaa409a4a9df2575e645528c35159115911b7c4e2f08ae49d68de97249b31b83ce2c163f649cad4559dc6e6a7191f2922d79a5fd6af167b
COUNT = 55
MD = 13f5825c41fa49edf6104e3e35c9c224eba93e37374f730004c39c54e7391e4a847fd61865235a3fe32224c96fbe86f7e14c3d5df496e83ec989a71b4f293a44
COUNT = 56
MD = e5b55e05efe1ca6b9a96a57e3a1523d610d70f837e93b31fa98c2736d3e114d238d46ec6b6e3d19e774b253f6b0c7a2ebe69b7e60fc0874444806b2a2278df45
COUNT = 57
MD = f14a586ac30f0af255f597a9aef9abba5e99c04d17b01f24427c4ee2c196b52acb1ceefc9b15cb822b3ecffdc2f7c49e11d3fc0769acee33361537d379c62e0c
COUNT = 58
MD = 7e2d3398807195c48e6ec52d20710bbf8b21ea8de4d1abc197897ccc58aeff40259edc67270cdae0edcc686c0d0dccc5760c1495ab1cf48482dc2000ae2d42ad
COUNT = 59
MD = 2f3d5c5f990bf615d5e8b396ccbd0337da39fad09b059f955a431db76a9dc720dffc4e02c0be397c7e0463799cd75fd6ab7c52bec66c8df5ef0d47e14a4c5927
COUNT = 60
MD = 483a1764d308cc494a2b543d29ba616483aefdf91c7769fd084eedaac1add1891df95d317a47430b2bf73e4081f86597020e28afe2d34a22b77ea62b6112d09a
COUNT = 61
MD = bfa88691ec951511651c6f14af100eeb26d87729e18ac3ef49a80d73ffeaeea53e97c4a7277a7ee9f2fba070b1c9720d6cdba407dd82267019e3f0f5662b2f2b
COUNT = 62
MD = 4c17c8e2e7132dbf82afebc40efc77926d16f4d2c082d846dac28733aa767e2840ebf04f2563df75933466a36e11968d342e4157827605d04d9627ce9b5216c8
COUNT = 63
MD = 70bbfc29a2a765220af84e7bb10d759a3152ad4b5643ef6b89966950ec7ef9503d57bc0a28c4ee789a60bf9dcac59139e15241d73b990410cf92eff213da9eca
COUNT = 64
MD = 8d1d56f37fc19b84984a6fa33aa9c2dbdbf79a29c04ad0b4cf20333e6bec943447be2416242f8cd2f9732e79bb925cc5a61a80c5fc9c079961243fd1c1f5900e
COUNT = 65
MD = 492fd0171f4dcd5d20ea6c0d34b5576c8894664ae5955e6737f5e3b711c2804d99ccca065b7ec18c82da98b18a3029b765c51ebc7c433b36492e0ed6b8511bb6
COUNT = 66
MD = 7f49e8e54db7e5b4323cae2db71f3e8b8eba172dcad3602e9b7b058007a5589358732d5afffa56072a46e89b1ea27ef8d556deb86b569c635d394f15d99d8a15
COUNT = 67
MD = 56884a6a9210d5f371e25823efb2511a9c410c26a441e07c1bdffe8605084267d49c315baf6a692d7d97844b2714b4930877a5d7f52cf6fa151700fcb6980546
COUNT = 68
MD = 6aaef8284eef221ecb17ea3c9596f075b5155fe7b925d737ed3c6543c761c28c7cd9d9d4b5e2a37b2f183a2a367bbd34b633497bc7a1737d61c8c1f3ef295062
COUNT = 69
MD = 38ef178f5688e59d47c375252db7b39f40c0c84169878ee7ba5086e4b25fea81076b9c37847e9e6bf24ae0b343689c265ec5ca7469e619acd61b0276721efb1b
COUNT = 70
MD = e3fe1aabad120777cf24eaae289b486632ca46ceb89afae73dbae5fa87c767879369355a9cc5c21ca604ed91d0f2f58c466573f3e6d88e52c62c0d3cb188e141
COUNT = 71
MD = 82f5bd920457bb2763a0da031a7fed47b236951b1ea420c20fd2b6de1dbfbb9c4600ea7092788493e2d4be6ee24b6dba04e57af3e8f2f14d9837295420ac7631
COUNT = 72
MD = 6d0b26208ba9b1615067bb3ff97b292fe67e4c02d240d649c32370e0a4cd22d03bdf864be4d24a3f5f51aeccfd1afd5191e590edeb5f7bec323b0506c3104b89
COUNT = 73
MD = d081083158054d08371ec84f4d3aa5aa761734ac6091a30330a861fda056f835c750bf4f7981af1693ff28545366bd05cec47bccd77a7d237befb0135c534138
COUNT = 74
MD = 6ba8b52780b8a07a2a2015dd8f0c5e7437b8e024c4ee428f7ba91dfea118cb72a939872550983317132b841b7cbc29a22b8f1cfea0c55203cafc69b55ed6244a
COUNT = 75
MD = 312692b0a51f002b7f06d05b39d15a5637dbddd2f4f1a73e6c88a4c841cdba5cd8e69c0939ab39bb1a9c54fa35402143c97edb9704a0e9e1a98701710f6a5dad
COUNT = 76
MD = aaee960de201a8dcccff95b834fccf0dafc03fe6cffc0429162bf4aff01165ab07a0c9435e9cb412121b7ba010657ccc3152118602b665072136317d92fd4262
COUNT = 77
MD = 21fdff552e08c86c07f080cefacaaaf31846eb893bfe2e4f88c3c3cd8cbf592a84500942695a5e5ae971ab343ce2695dd1baeb1f94dd4b53d678e14265e421ae
COUNT = 78
MD = ca8f1a5b2172f6adb474da53b35e3f73ffd88263d3eecde72e48b16e1a0658015b555ee319005a1d82802e91431ee777610f9b1028d819921e1044ad426b0270
COUNT = 79
MD = ce5ab25eff9c1ddc569a1eaaa66b689109ee269db7066e0b02d39b3564fd14ca6249987b7791e203d3d7c2ebf18558d2f23f94c03dd1d03aa63849e4d2889a76
COUNT = 80
MD = a6f8b0561000dd4ae8b828c5f676e8c1a6474c4a042a645f1815bd52e9ff53c97dc36d5d8997f8ce332185feead76267f5b2e63f597fb3345ca0046e58fc0f24
COUNT = 81
MD = fec86794bad4106c5ad1c1a2d9a1b7aae480396ec231eb5cac21c4077d17a0b652da0037363399a5a1dababa4a40e4c54b9124167580dee9108c4dbb24c57512
COUNT = 82
MD = 594f5dd3f4c87bdc0d81309386e9163a9718e34c7b0dcb4613f8487aa786f9d211cfb61bb247fa9f5ecef042e710f192850f5571807294bfd8a54397850e5773
COUNT = 83
MD = d81ad866f25ef6a0a6431d267114da564513e5ebdcf48db7e95db8cf32a89f0ab107874d796035db97420ffcf1db5f04dc1a52ddbbb960fc63b7f3f835cc8be6
COUNT = 84
MD = 431d537e098e9949f6a68108d55d20952e3bfcdeb7273bac3917e37790a84fa5db04c33a79c113a06cf333e831d7702a00853a93fd0aa5146d934f4f71242a6a
COUNT = 85
MD = 4ed95636c6885ae4e63d042e82f4da830c702dbf3b9746d64770a64dd666b33208315f3a947c4dff790771ef283788a9c74da83e22b97f750286a820ee46698c
COUNT = 86
MD = a9bcb60b4d7724cdddddbc232b4ac70b94d0d7e9f0724b1222d918930cbb9bdbb04b3ad43e3c8caf3bf8b004ee4aec6bd527ff8eb6189b44827f7ba7057f6a90
COUNT = 87
MD = d6d5e44d5bb07fc4144ab6ab309f048968f73f7992beb326047e9e2cd7af6240bc8abf46703c32fdb58fb2a8672594a660ef855be74f24cec09d4fb00219de82
COUNT = 88
MD = dfda9ac0c7147530da97715ccf47814182255f2f2cf40287db97a4c63b43fcd39e6d41e560921492badb253a7dea0aba863c7c33b912bb59d1ff4de03a4f03bb
COUNT = 89
MD = 0395faaaf2e907f27779d6f1cc9c9db68ec390a38fbb0702c6475b46f7a399498d46fd8014f834b131e1e83abba0359b1f16d8fc0a393580615def2ad0caba73
COUNT = 90
MD = 41cb98f09029abe85d24a0f131f116c7f69f54f7e91c250642606512bf3da4ca89ba70a4714a5f66d9ae81ff09317dadaff12a02057074c970f0f02a52bfafd2
COUNT = 91
MD = 8e8f161d48e306c5533ed614b8ef3a1979df6db7e13d0780a73c4a3980ddf0a95f93941d412c93683e39915a660c3fbec0dbb1bb6beea2e2099cd968011535c0
COUNT = 92
MD = 789593f0b8fb83ef9b3ec50ab8f6e1e47344f763d4f7ceab5600989e7b6fd5fef6ee5e487975f64474af6cd71ae4d9ecce8f009edea0227c7ebe73080b8f961b
COUNT = 93
MD = f37e1449e0b313d9537a6177f7a31158d353e5b79c781facf02526ec94e0c6cfda37105bac67098b194ea82efb307c2929a9ab8aca0e76c53e829e3f901cd245
COUNT = 94
MD = 2e74e745caaf2d449ab3b031dd214b48616853a512cf2e95c40cb8e7594fe5e4879ac8a26d02eb35b3b96a5c9e7dcae3e15fd050a0bcc1fb3b9cb9c4df0fad3e
COUNT = 95
MD = 6eac7069c26082e52574ca6a58abb9b1b9faf452e8cca9f1c7023679ce192ca554892f30e38104d39088a24df35612444a0fc90084af7535fd9344fa51dded84
COUNT = 96
MD = ada6caf30c4f6e3644d952366e01519af6771b406e2c447552f0c597b8dd10e9e9b4e699c9a835de03f422be8980538d9786172dfd2fe511db272a1543d5aa35
COUNT = 97
MD = 4d4b0086b2cb05d713f2805caa7e6605c8f7dbbb2e0f92aa159aebdcd63060305f47b748f1bca6e0b6e11cf8f9697fcccb6584b878c4b54a699290728a40aa1b
COUNT = 98
MD = 97420b8a0ad102aeb92139da2c052d2748dd7d2dbb93a9ea79dc15b520d0ca7cab8cb7a00f5b5aebcb49d7e7f52a27180935ce617aeecdecba04064c668edd37
COUNT = 99
MD = 4aa7dad74eb51d09a6ae7735c4b795b078f51c314f14f42a0d63071e13bdc5fd9f51612e77b36d44567502a3b5eb66c609ec017e51d8df93e58d1a44f3c1e375
# CAVS 11.1
# "SHA-512 Monte" information for "sha_values"
# SHA-512 tests are configured for BYTE oriented implementations
# Generated on Wed May 11 17:26:11 2011
[L = 64]
Seed = 5c337de5caf35d18ed90b5cddfce001ca1b8ee8602f367e7c24ccca6f893802fb1aca7a3dae32dcd60800a59959bc540d63237876b799229ae71a2526fbc52cd
COUNT = 0
MD = ada69add0071b794463c8806a177326735fa624b68ab7bcab2388b9276c036e4eaaff87333e83c81c0bca0359d4aeebcbcfd314c0630e0c2af68c1fb19cc470e
COUNT = 1
MD = ef219b37c24ae507a2b2b26d1add51b31fb5327eb8c3b19b882fe38049433dbeccd63b3d5b99ba2398920bcefb8aca98cd28a1ee5d2aaf139ce58a15d71b06b4
COUNT = 2
MD = c3d5087a62db0e5c6f5755c417f69037308cbce0e54519ea5be8171496cc6d18023ba15768153cfd74c7e7dc103227e9eed4b0f82233362b2a7b1a2cbcda9daf
COUNT = 3
MD = bb3a58f71148116e377505461d65d6c89906481fedfbcfe481b7aa8ceb977d252b3fe21bfff6e7fbf7575ceecf5936bd635e1cf52698c36ef6908ddbd5b6ae05
COUNT = 4
MD = b68f0cd2d63566b3934a50666dec6d62ca1db98e49d7733084c1f86d91a8a08c756fa7ece815e20930dd7cb66351bad8c087c2f94e8757cb98e7f4b86b21a8a8
COUNT = 5
MD = 937d7856a82a84c163c79417d0540c47daaf9ffe662c843737dbbcbe5f865bf6f47a9d2bd10129a4f498073094653c324a2519a1c71ac1279b1623ff7d24647a
COUNT = 6
MD = f8fbc058c2b9f84131c9decfa543a35ade41581f670398efd61b3abfced9c1cfcb5324f2370487f9c59a65bc668ea596c8d22ce8a33014dfad28357fa7d05f04
COUNT = 7
MD = 4ab0c9484ff5c30fa64ae6e81510c5fea566eafb88f175f8bc19109f40fe80014c8b77fff10b8750778429bf3c5497e4cb92d9b30014f4cb975dff2a45244c28
COUNT = 8
MD = 685179397554d276513d630234a03419808c698abf2600d7490aabb8e455c6ab6ea412c7729dc140a79dff66533c6946cbe90f9da9ed16e2e629db1651bea870
COUNT = 9
MD = 335e6e941ab7dadfecdb74ea6cb4e8584b6e3408841a33a6cf7fd6a63294b1930a60983240311672acac3840a90e64cc366ce75081b2252627e9c31197ebad03
COUNT = 10
MD = e3217f6af6e279e9445dc3738cbf9ba0e9edba0455844a73648139777afdea2c4d8032e214f541bf92675fb23f24df8e4fe98e0003aadfb6d8f9cc2cd799bbf7
COUNT = 11
MD = ee2fdfb3ae630613b7d890977cf2515deac272a37f27e4a01961ecf103d4ff5b45cc8aef53b635dd75aa51aabf71c0642555ccd3281e0388f8ca09d83258cf30
COUNT = 12
MD = 6a30d97cc98af6a25b673dce7aeab8d762bf2e55ea0c6dc899179281f84dd02a2896f77e9c106b472f55f7adbef7b1157be567ee1236ebdac2a3c5d8cb133eb5
COUNT = 13
MD = ac1176abdc5f71170183d92ae55856221b0d95590af11d9d72ba605ec026bbec52d6974bc43a1efb125ff2b161fbdc616fda00f04193a0bc26aacdfa052a5741
COUNT = 14
MD = 59fa909480620ecc08d34531a6da1b55158b74fc93ddf68e1d242615b6f3843a7952e63e798c6445cde1b07e0be09d0d711cb7b42a0e7760a593b08acfceb63d
COUNT = 15
MD = 9eb253319efa61b864f27bd334d7dd78b38d3265fb544e0c8edee950a547e1d8db921a285774ab94d66beae933298d20f2a5aa87c62fe1e383cc3b18e7af18ac
COUNT = 16
MD = 81735324005671f7bdad9e685ee8257f5e0622b9fcb5d38dbdfb2df27258c3e1d46d76e24c0c92c744e1b50a2b4b0d31525b3af83cc80a75722d921bdeef59c4
COUNT = 17
MD = 17498cdff4323bb8021e44eca6559e05d8ff9a0ef2ee9d4ba0ac6e73f83972a0dfbb6d47728fa70311d7c82e154966e1b7678263b0f65133e9116969193d429b
COUNT = 18
MD = 228c4574d7c45eb9ba9240722133fce74abe00c7328ab30b4bde373dc79afdd6e0569d36268cd5eaa2f27205fc00512577bcbb6699e1d66ed85eafaba7548afb
COUNT = 19
MD = 3d40ccd9cc445bbecca9227c67fe455d89e0b7c1c858d32f30e2b544ca9a5a606535aea2e59fec6ec4d1ba898cc4338c6eadef9c0884bcf56aca2f481a2d7d3e
COUNT = 20
MD = e1e577aeac92e3a2b7f8a262bf2ac9c037d2274ca6618fbe4cc21db7c699e9946b6671ae45ea433a1e392a5bc9eec96fd641ba8f4a047f022a04a337227004df
COUNT = 21
MD = 5e4424c0bcb2f0f7a2428821a9d5840a82401f4440ae6bed25c53cd9e71cf9d39904d6a375bd721f4332ab0202529c91feb9c094c3e6d34ca4f66649ee6fa212
COUNT = 22
MD = 56b199d63ca37189d5ca0d40006ac7bcb9f39cbdc00ef7b8a5697caa7d81d05b645a146995b1151d01958f1589337e14afc6e7dd10a815170e527a398e6ce8c3
COUNT = 23
MD = d2d498ff93fb03013a64f295b5bc68e57d2fb5600da578aa011d43ff432eae3e0c800f9e2a53155e56fdbf5e068fe2b4beb3e42b2585531b8b16c4d8ca3356c6
COUNT = 24
MD = 3d3875489903710f17cf4247b5842ace6f017b1a3b99e9ee5fbc04fc7898e78b12693879878028ca40c63cd0f6925fb7d0ca0412e4f06619e3ace223690f03b8
COUNT = 25
MD = a013e21cd1234483c95c2ea2757be949bc79401ba39b09c316a1612d594642be65ca106e12695ac3808c57c6f2980e895fd1fe188946562afc238414e1e43649
COUNT = 26
MD = c5f6367d7195489e16242f912fbe0d8002e947de3a7e9c53f77b1e5e90e05bd7ca395e787e34cb5f500c02da59c9d83de35601de7ae80dae74a0d6b4a292d43b
COUNT = 27
MD = 7c28c44c6aaba83c122f24d68273e28a5afd65b4071d02b7ea3300478d5118971e1356ae57cbc70d2a177ea464a1c2c50d4297b933e789c63b1481797ae8f08c
COUNT = 28
MD = af7cb42b1c70a85ac1ae1c2991b25b657c19f4fcf83af7f7dc0ae1028c1452a6a17dc98929634fe6ed3855b70b96bc2caa93d82037b94ebeddc77e4c1a7cc563
COUNT = 29
MD = bd56ad4c0cbd162706053da929d667253aadcf417affb483fff4f2699bf406d128cfdf5196dfbb05bb89ccbf04c5147bd2ebb3156b0bc1768ca6faa171c91c01
COUNT = 30
MD = 004d7b0fff9bcddf4b3913ae190a76728705a3d23874d92a8b7ff246c8fcad46623cb04723c8aded0cba4968d1a8cc1375b99005786c1bcb7ae4bf13325c3ae0
COUNT = 31
MD = 8299a5bf5ed64f525c4eebbeca969fc1b91a81adb58c584bdd2d7676386a31fa546643a3cf505007584f02fb712d708cab645bf078a1b9339f5a76aee985d017
COUNT = 32
MD = ce7100f3455db1a9776a9f40d562ea998afca1f9fee7e0d81c8db34cf68ad23a8bfa6fc04774703e1e56d5196b66966158fcf2a8335a58c6ba7ba1af756ba1dc
COUNT = 33
MD = 90aaabcb655ee921b8350229efe6064a60051cf0cac858fa3d43afd5b97cc82301bd1b8cc1f874022e5af948185638783a13ca1bbd5049ace7fbf4f6d90c201f
COUNT = 34
MD = 3cf0a25b33ded3e0806dfe603b9987f1d6f2b3fdcb1ec7f8566828c00e17e8f59e38b3bca302396c7525ca194e6cc8501369059e2e34ae21e3141215876847c4
COUNT = 35
MD = bdc5266aee339a1ff13fcf5229773cd3d14b47101e83076927c160bb71bf7445590525a2012d52af008e118e16df1b6bfcaf8f22b4e45f9e749f3c20625a2bc8
COUNT = 36
MD = ef8d2ba885381ab97756d59dbbbf53a1ea35d152b2d8f82c3518430aa34e708359194ea43950d032e151f576d343a5c3cfe6b71d4ed0ead9d3a107402589bad0
COUNT = 37
MD = 194ea5324c4179998dd7057755f255fdea04dadf533f7851e3e9718b610948e32fd28323077d9421142ac808978adfa325b668c8599a2e01c757a5a14ed2dd37
COUNT = 38
MD = 106984d2f0087e621dae760552bc6279072267883c204079481af6034354f1a2b77c17e6c039a1063e479342aa3ccd90330dd3fb5a7d5e976619497e2d3326cd
COUNT = 39
MD = a1347216f1a6db47b90c4ded3c5c75440f54c22c87d538314d1340f86f88acba01378acb933ddad0adc6b75d55bfb7e8efc9c4a531b2a410610b7515b6dac66a
COUNT = 40
MD = b76e4db147e0eaa4f04880654088b9d0fce518c8c377d92c846345604dc6b2b18d377fdb8e30f06d9bcfe6d7dacc07d6adff73d98d49f8f132b80f3084390830
COUNT = 41
MD = acd4e527763dfd4513f0def0b1edf8ea12dc78d336b7b796f3dcc32e1068725443a2f55ab4f666b27d6bf2ab39669c98293f0a9108051fd3144d31a1ed171ddd
COUNT = 42
MD = 10128c15494bc87a87374f676ef9fe2df20b36ffcca41a80bd40b216637b3de710efd070e277827820a7bba3cceb7b21f8fe7f9775d6c4df4d3da5349434ec49
COUNT = 43
MD = 2632dd5c188c6ed3a4610405fdda704add752f5424d9de65a51400fe478e26cd0412e5f91ca4b744c34f4954f40a3a4254431d21954623208b527b7b4daa687e
COUNT = 44
MD = 45707f5b6fc5ccd1f78d77f177d10fb8b462c74cc821518cd5cfa4b5d6b40b418044900693c37abbb82367d340fec67f800d74072935da1706b4d90ae26099c7
COUNT = 45
MD = 56c37f31220b5b3040373d91b2c5e42fe9e601a12f7f8dc4534459bf28e484b8713db243c5782c031e674003a3c14c42fd152e7188789065e82795e10f87d54b
COUNT = 46
MD = 5da94c899d48bd8299fee3d81662f8d6c5f8f8bc54d18cb0368b13cebaee7ad71e74ea80f34974ad166f04f9a0602809166fe4085a475a8ca86cade12b6754c4
COUNT = 47
MD = 0664363f97ba910760b0922e31ca880ca97469506cb007e3108c36c3ce3ce1801fb4197609479339e8820632b6a38bffffee05a9adc11cc544b9aa6f5b95cc6f
COUNT = 48
MD = 732c41a1edaa727c04f627ff158aaff67c18efd667216132b99ab84d108996a10bb008b5d803b22ed1aa78bb0d10f8a762fd34777d7dccce8e84827ba88d4193
COUNT = 49
MD = fc9c21d67e393a2b05a23a17d8db630cbaebaa3def211181749f1bcad181560627fb60ee20fae2e5980cbf50fce0a19dce807e7fb75c4da0ef008bc75d413a65
COUNT = 50
MD = 0453b765afc1edffa595efe345177f5805ed3abc1297ceab757ae7161723a6144cb543299f418049276d16b7896662631634fab9549127c10f27505b7dee8665
COUNT = 51
MD = 3853f3bf024e0668e8d1ea53733a97537f97d9307c5f3a19864ab4eeb1654710693bb961a344dec8a758f5e64b26fcb6dd423419c4a114fa749211a9de06c281
COUNT = 52
MD = 240137f0dd57beb3f7fc283bb3ead423c67883fd46f4e27471d7be57ad469a49bad03a3658418bd55614678f3a463bceff85291314b90ef43ccbcb028f0a7a07
COUNT = 53
MD = f9050a5271edbe4cfdb9520ec05bbdc3cbcb9bce36fd212338d3e7028a39b9ab30793e561d75a2e424193264c7f0775e65599ef0c94e0ad24dbfe18252364267
COUNT = 54
MD = 47caa7a5862fad837aaa409a4a9df2575e645528c35159115911b7c4e2f08ae49d68de97249b31b83ce2c163f649cad4559dc6e6a7191f2922d79a5fd6af167b
COUNT = 55
MD = 13f5825c41fa49edf6104e3e35c9c224eba93e37374f730004c39c54e7391e4a847fd61865235a3fe32224c96fbe86f7e14c3d5df496e83ec989a71b4f293a44
COUNT = 56
MD = e5b55e05efe1ca6b9a96a57e3a1523d610d70f837e93b31fa98c2736d3e114d238d46ec6b6e3d19e774b253f6b0c7a2ebe69b7e60fc0874444806b2a2278df45
COUNT = 57
MD = f14a586ac30f0af255f597a9aef9abba5e99c04d17b01f24427c4ee2c196b52acb1ceefc9b15cb822b3ecffdc2f7c49e11d3fc0769acee33361537d379c62e0c
COUNT = 58
MD = 7e2d3398807195c48e6ec52d20710bbf8b21ea8de4d1abc197897ccc58aeff40259edc67270cdae0edcc686c0d0dccc5760c1495ab1cf48482dc2000ae2d42ad
COUNT = 59
MD = 2f3d5c5f990bf615d5e8b396ccbd0337da39fad09b059f955a431db76a9dc720dffc4e02c0be397c7e0463799cd75fd6ab7c52bec66c8df5ef0d47e14a4c5927
COUNT = 60
MD = 483a1764d308cc494a2b543d29ba616483aefdf91c7769fd084eedaac1add1891df95d317a47430b2bf73e4081f86597020e28afe2d34a22b77ea62b6112d09a
COUNT = 61
MD = bfa88691ec951511651c6f14af100eeb26d87729e18ac3ef49a80d73ffeaeea53e97c4a7277a7ee9f2fba070b1c9720d6cdba407dd82267019e3f0f5662b2f2b
COUNT = 62
MD = 4c17c8e2e7132dbf82afebc40efc77926d16f4d2c082d846dac28733aa767e2840ebf04f2563df75933466a36e11968d342e4157827605d04d9627ce9b5216c8
COUNT = 63
MD = 70bbfc29a2a765220af84e7bb10d759a3152ad4b5643ef6b89966950ec7ef9503d57bc0a28c4ee789a60bf9dcac59139e15241d73b990410cf92eff213da9eca
COUNT = 64
MD = 8d1d56f37fc19b84984a6fa33aa9c2dbdbf79a29c04ad0b4cf20333e6bec943447be2416242f8cd2f9732e79bb925cc5a61a80c5fc9c079961243fd1c1f5900e
COUNT = 65
MD = 492fd0171f4dcd5d20ea6c0d34b5576c8894664ae5955e6737f5e3b711c2804d99ccca065b7ec18c82da98b18a3029b765c51ebc7c433b36492e0ed6b8511bb6
COUNT = 66
MD = 7f49e8e54db7e5b4323cae2db71f3e8b8eba172dcad3602e9b7b058007a5589358732d5afffa56072a46e89b1ea27ef8d556deb86b569c635d394f15d99d8a15
COUNT = 67
MD = 56884a6a9210d5f371e25823efb2511a9c410c26a441e07c1bdffe8605084267d49c315baf6a692d7d97844b2714b4930877a5d7f52cf6fa151700fcb6980546
COUNT = 68
MD = 6aaef8284eef221ecb17ea3c9596f075b5155fe7b925d737ed3c6543c761c28c7cd9d9d4b5e2a37b2f183a2a367bbd34b633497bc7a1737d61c8c1f3ef295062
COUNT = 69
MD = 38ef178f5688e59d47c375252db7b39f40c0c84169878ee7ba5086e4b25fea81076b9c37847e9e6bf24ae0b343689c265ec5ca7469e619acd61b0276721efb1b
COUNT = 70
MD = e3fe1aabad120777cf24eaae289b486632ca46ceb89afae73dbae5fa87c767879369355a9cc5c21ca604ed91d0f2f58c466573f3e6d88e52c62c0d3cb188e141
COUNT = 71
MD = 82f5bd920457bb2763a0da031a7fed47b236951b1ea420c20fd2b6de1dbfbb9c4600ea7092788493e2d4be6ee24b6dba04e57af3e8f2f14d9837295420ac7631
COUNT = 72
MD = 6d0b26208ba9b1615067bb3ff97b292fe67e4c02d240d649c32370e0a4cd22d03bdf864be4d24a3f5f51aeccfd1afd5191e590edeb5f7bec323b0506c3104b89
COUNT = 73
MD = d081083158054d08371ec84f4d3aa5aa761734ac6091a30330a861fda056f835c750bf4f7981af1693ff28545366bd05cec47bccd77a7d237befb0135c534138
COUNT = 74
MD = 6ba8b52780b8a07a2a2015dd8f0c5e7437b8e024c4ee428f7ba91dfea118cb72a939872550983317132b841b7cbc29a22b8f1cfea0c55203cafc69b55ed6244a
COUNT = 75
MD = 312692b0a51f002b7f06d05b39d15a5637dbddd2f4f1a73e6c88a4c841cdba5cd8e69c0939ab39bb1a9c54fa35402143c97edb9704a0e9e1a98701710f6a5dad
COUNT = 76
MD = aaee960de201a8dcccff95b834fccf0dafc03fe6cffc0429162bf4aff01165ab07a0c9435e9cb412121b7ba010657ccc3152118602b665072136317d92fd4262
COUNT = 77
MD = 21fdff552e08c86c07f080cefacaaaf31846eb893bfe2e4f88c3c3cd8cbf592a84500942695a5e5ae971ab343ce2695dd1baeb1f94dd4b53d678e14265e421ae
COUNT = 78
MD = ca8f1a5b2172f6adb474da53b35e3f73ffd88263d3eecde72e48b16e1a0658015b555ee319005a1d82802e91431ee777610f9b1028d819921e1044ad426b0270
COUNT = 79
MD = ce5ab25eff9c1ddc569a1eaaa66b689109ee269db7066e0b02d39b3564fd14ca6249987b7791e203d3d7c2ebf18558d2f23f94c03dd1d03aa63849e4d2889a76
COUNT = 80
MD = a6f8b0561000dd4ae8b828c5f676e8c1a6474c4a042a645f1815bd52e9ff53c97dc36d5d8997f8ce332185feead76267f5b2e63f597fb3345ca0046e58fc0f24
COUNT = 81
MD = fec86794bad4106c5ad1c1a2d9a1b7aae480396ec231eb5cac21c4077d17a0b652da0037363399a5a1dababa4a40e4c54b9124167580dee9108c4dbb24c57512
COUNT = 82
MD = 594f5dd3f4c87bdc0d81309386e9163a9718e34c7b0dcb4613f8487aa786f9d211cfb61bb247fa9f5ecef042e710f192850f5571807294bfd8a54397850e5773
COUNT = 83
MD = d81ad866f25ef6a0a6431d267114da564513e5ebdcf48db7e95db8cf32a89f0ab107874d796035db97420ffcf1db5f04dc1a52ddbbb960fc63b7f3f835cc8be6
COUNT = 84
MD = 431d537e098e9949f6a68108d55d20952e3bfcdeb7273bac3917e37790a84fa5db04c33a79c113a06cf333e831d7702a00853a93fd0aa5146d934f4f71242a6a
COUNT = 85
MD = 4ed95636c6885ae4e63d042e82f4da830c702dbf3b9746d64770a64dd666b33208315f3a947c4dff790771ef283788a9c74da83e22b97f750286a820ee46698c
COUNT = 86
MD = a9bcb60b4d7724cdddddbc232b4ac70b94d0d7e9f0724b1222d918930cbb9bdbb04b3ad43e3c8caf3bf8b004ee4aec6bd527ff8eb6189b44827f7ba7057f6a90
COUNT = 87
MD = d6d5e44d5bb07fc4144ab6ab309f048968f73f7992beb326047e9e2cd7af6240bc8abf46703c32fdb58fb2a8672594a660ef855be74f24cec09d4fb00219de82
COUNT = 88
MD = dfda9ac0c7147530da97715ccf47814182255f2f2cf40287db97a4c63b43fcd39e6d41e560921492badb253a7dea0aba863c7c33b912bb59d1ff4de03a4f03bb
COUNT = 89
MD = 0395faaaf2e907f27779d6f1cc9c9db68ec390a38fbb0702c6475b46f7a399498d46fd8014f834b131e1e83abba0359b1f16d8fc0a393580615def2ad0caba73
COUNT = 90
MD = 41cb98f09029abe85d24a0f131f116c7f69f54f7e91c250642606512bf3da4ca89ba70a4714a5f66d9ae81ff09317dadaff12a02057074c970f0f02a52bfafd2
COUNT = 91
MD = 8e8f161d48e306c5533ed614b8ef3a1979df6db7e13d0780a73c4a3980ddf0a95f93941d412c93683e39915a660c3fbec0dbb1bb6beea2e2099cd968011535c0
COUNT = 92
MD = 789593f0b8fb83ef9b3ec50ab8f6e1e47344f763d4f7ceab5600989e7b6fd5fef6ee5e487975f64474af6cd71ae4d9ecce8f009edea0227c7ebe73080b8f961b
COUNT = 93
MD = f37e1449e0b313d9537a6177f7a31158d353e5b79c781facf02526ec94e0c6cfda37105bac67098b194ea82efb307c2929a9ab8aca0e76c53e829e3f901cd245
COUNT = 94
MD = 2e74e745caaf2d449ab3b031dd214b48616853a512cf2e95c40cb8e7594fe5e4879ac8a26d02eb35b3b96a5c9e7dcae3e15fd050a0bcc1fb3b9cb9c4df0fad3e
COUNT = 95
MD = 6eac7069c26082e52574ca6a58abb9b1b9faf452e8cca9f1c7023679ce192ca554892f30e38104d39088a24df35612444a0fc90084af7535fd9344fa51dded84
COUNT = 96
MD = ada6caf30c4f6e3644d952366e01519af6771b406e2c447552f0c597b8dd10e9e9b4e699c9a835de03f422be8980538d9786172dfd2fe511db272a1543d5aa35
COUNT = 97
MD = 4d4b0086b2cb05d713f2805caa7e6605c8f7dbbb2e0f92aa159aebdcd63060305f47b748f1bca6e0b6e11cf8f9697fcccb6584b878c4b54a699290728a40aa1b
COUNT = 98
MD = 97420b8a0ad102aeb92139da2c052d2748dd7d2dbb93a9ea79dc15b520d0ca7cab8cb7a00f5b5aebcb49d7e7f52a27180935ce617aeecdecba04064c668edd37
COUNT = 99
MD = 4aa7dad74eb51d09a6ae7735c4b795b078f51c314f14f42a0d63071e13bdc5fd9f51612e77b36d44567502a3b5eb66c609ec017e51d8df93e58d1a44f3c1e375

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,26 @@
environment:
matrix:
- TARGET: x86_64-pc-windows-msvc
VERSION: nightly
- TARGET: i686-pc-windows-msvc
VERSION: nightly
- TARGET: x86_64-pc-windows-gnu
VERSION: nightly
- TARGET: i686-pc-windows-gnu
VERSION: 1.40.0
access_token:
secure: ZxcrtxQXwszRYNN6c1ZIagczEqzmQQZeYHY58izcmF0jdq/cptxJvFUoVxDmnoqj
install:
- ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-${env:VERSION}-${env:TARGET}.exe" -FileName "rust-nightly.exe"
- ps: .\rust-nightly.exe /VERYSILENT /NORESTART /DIR="C:\rust" | Out-Null
- ps: $env:PATH="$env:PATH;C:\rust\bin"
- rustc -vV
- cargo -vV
- echo install
build: off
test_script:
# TODO remove this loop when server 2016 lands on appveyor; related to https://github.com/steffengy/schannel-rs/issues/8
- set RUST_BACKTRACE=1
- ps: for($i=1; $i -le 3; $i++) { cmd /c "cargo test 2>&1"; if ($?) { break } }
environment:
matrix:
- TARGET: x86_64-pc-windows-msvc
VERSION: nightly
- TARGET: i686-pc-windows-msvc
VERSION: nightly
- TARGET: x86_64-pc-windows-gnu
VERSION: nightly
- TARGET: i686-pc-windows-gnu
VERSION: 1.40.0
access_token:
secure: ZxcrtxQXwszRYNN6c1ZIagczEqzmQQZeYHY58izcmF0jdq/cptxJvFUoVxDmnoqj
install:
- ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-${env:VERSION}-${env:TARGET}.exe" -FileName "rust-nightly.exe"
- ps: .\rust-nightly.exe /VERYSILENT /NORESTART /DIR="C:\rust" | Out-Null
- ps: $env:PATH="$env:PATH;C:\rust\bin"
- rustc -vV
- cargo -vV
- echo install
build: off
test_script:
# TODO remove this loop when server 2016 lands on appveyor; related to https://github.com/steffengy/schannel-rs/issues/8
- set RUST_BACKTRACE=1
- ps: for($i=1; $i -le 3; $i++) { cmd /c "cargo test 2>&1"; if ($?) { break } }

View File

@ -1,3 +1,3 @@
//! Deprecated.
#[deprecated(note = "use cert_context::PrivateKey", since = "0.1.5")]
pub use crate::cert_context::PrivateKey as KeyHandle;
//! Deprecated.
#[deprecated(note = "use cert_context::PrivateKey", since = "0.1.5")]
pub use crate::cert_context::PrivateKey as KeyHandle;

View File

@ -1,73 +1,73 @@
# Changelog
## 1.6.0
* [i509VCB](https://github.com/i509VCB) added the `try_` functions for fallable reallocation.
[pr 158](https://github.com/Lokathor/tinyvec/pull/158)
* [ajtribick](https://github.com/ajtribick) added more error impls to `TryFromSliceError`.
[pr 160](https://github.com/Lokathor/tinyvec/pull/160)
* The `std` feature now automatically enables the `alloc` feature as well.
## 1.5.1
* [madsmtm](https://github.com/madsmtm) fixed an error with the `alloc` feature on very old rustc versions.
[pr 154](https://github.com/Lokathor/tinyvec/pull/154)
## 1.5.0
* [eeeebbbbrrrr](https://github.com/eeeebbbbrrrr) added an impl for [std::io::Write](https://doc.rust-lang.org/std/io/trait.Write.html) to `TinyVec` when the element type is `u8`.
This is gated behind the new `std` feature.
[pr 152](https://github.com/Lokathor/tinyvec/pull/152)
## 1.4.0
* [saethlin](https://github.com/saethlin) stabilized the usage of const generics and array map with the `rustc_1_55` feature.
[pr 149](https://github.com/Lokathor/tinyvec/pull/149)
## 1.3.1
* Improved the performance of the `clone_from` method [pr 144](https://github.com/Lokathor/tinyvec/pull/144)
## 1.3.0
* [jeffa5](https://github.com/jeffa5) added arbitrary implementations for `TinyVec` and `ArrayVec` [pr 146](https://github.com/Lokathor/tinyvec/pull/146).
* [elomatreb](https://github.com/elomatreb) implemented `DoubleEndedIterator` for `TinyVecIterator` [pr 145](https://github.com/Lokathor/tinyvec/pull/145).
## 1.2.0
* [Cryptjar](https://github.com/Cryptjar) removed the `A:Array` bound on the struct of `ArrayVec<A:Array>`,
and added the `from_array_empty` method, which is a `const fn` constructor
[pr 141](https://github.com/Lokathor/tinyvec/pull/141).
## 1.1.1
* [saethlin](https://github.com/saethlin) contributed many PRs (
[127](https://github.com/Lokathor/tinyvec/pull/127),
[128](https://github.com/Lokathor/tinyvec/pull/128),
[129](https://github.com/Lokathor/tinyvec/pull/129),
[131](https://github.com/Lokathor/tinyvec/pull/131),
[132](https://github.com/Lokathor/tinyvec/pull/132)
) to help in several benchmarks.
## 1.1.0
* [slightlyoutofphase](https://github.com/slightlyoutofphase)
added "array splat" style syntax to the `array_vec!` and `tiny_vec!` macros.
You can now write `array_vec![true; 5]` and get a length 5 array vec full of `true`,
just like normal array initialization allows. Same goes for `tiny_vec!`.
([pr 118](https://github.com/Lokathor/tinyvec/pull/118))
* [not-a-seagull](https://github.com/not-a-seagull)
added `ArrayVec::into_inner` so that you can get the array out of an `ArrayVec`.
([pr 124](https://github.com/Lokathor/tinyvec/pull/124))
## 1.0.2
* Added license files for the MIT and Apache-2.0 license options.
## 1.0.1
* Display additional features in the [docs.rs/tinyvec](https://docs.rs/tinyvec) documentation.
## 1.0.0
Initial Stable Release.
# Changelog
## 1.6.0
* [i509VCB](https://github.com/i509VCB) added the `try_` functions for fallable reallocation.
[pr 158](https://github.com/Lokathor/tinyvec/pull/158)
* [ajtribick](https://github.com/ajtribick) added more error impls to `TryFromSliceError`.
[pr 160](https://github.com/Lokathor/tinyvec/pull/160)
* The `std` feature now automatically enables the `alloc` feature as well.
## 1.5.1
* [madsmtm](https://github.com/madsmtm) fixed an error with the `alloc` feature on very old rustc versions.
[pr 154](https://github.com/Lokathor/tinyvec/pull/154)
## 1.5.0
* [eeeebbbbrrrr](https://github.com/eeeebbbbrrrr) added an impl for [std::io::Write](https://doc.rust-lang.org/std/io/trait.Write.html) to `TinyVec` when the element type is `u8`.
This is gated behind the new `std` feature.
[pr 152](https://github.com/Lokathor/tinyvec/pull/152)
## 1.4.0
* [saethlin](https://github.com/saethlin) stabilized the usage of const generics and array map with the `rustc_1_55` feature.
[pr 149](https://github.com/Lokathor/tinyvec/pull/149)
## 1.3.1
* Improved the performance of the `clone_from` method [pr 144](https://github.com/Lokathor/tinyvec/pull/144)
## 1.3.0
* [jeffa5](https://github.com/jeffa5) added arbitrary implementations for `TinyVec` and `ArrayVec` [pr 146](https://github.com/Lokathor/tinyvec/pull/146).
* [elomatreb](https://github.com/elomatreb) implemented `DoubleEndedIterator` for `TinyVecIterator` [pr 145](https://github.com/Lokathor/tinyvec/pull/145).
## 1.2.0
* [Cryptjar](https://github.com/Cryptjar) removed the `A:Array` bound on the struct of `ArrayVec<A:Array>`,
and added the `from_array_empty` method, which is a `const fn` constructor
[pr 141](https://github.com/Lokathor/tinyvec/pull/141).
## 1.1.1
* [saethlin](https://github.com/saethlin) contributed many PRs (
[127](https://github.com/Lokathor/tinyvec/pull/127),
[128](https://github.com/Lokathor/tinyvec/pull/128),
[129](https://github.com/Lokathor/tinyvec/pull/129),
[131](https://github.com/Lokathor/tinyvec/pull/131),
[132](https://github.com/Lokathor/tinyvec/pull/132)
) to help in several benchmarks.
## 1.1.0
* [slightlyoutofphase](https://github.com/slightlyoutofphase)
added "array splat" style syntax to the `array_vec!` and `tiny_vec!` macros.
You can now write `array_vec![true; 5]` and get a length 5 array vec full of `true`,
just like normal array initialization allows. Same goes for `tiny_vec!`.
([pr 118](https://github.com/Lokathor/tinyvec/pull/118))
* [not-a-seagull](https://github.com/not-a-seagull)
added `ArrayVec::into_inner` so that you can get the array out of an `ArrayVec`.
([pr 124](https://github.com/Lokathor/tinyvec/pull/124))
## 1.0.2
* Added license files for the MIT and Apache-2.0 license options.
## 1.0.1
* Display additional features in the [docs.rs/tinyvec](https://docs.rs/tinyvec) documentation.
## 1.0.0
Initial Stable Release.

View File

@ -1,202 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,5 +1,5 @@
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.
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.

View File

@ -1,11 +1,11 @@
Copyright (c) 2019 Daniel "Lokathor" Gee.
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Copyright (c) 2019 Daniel "Lokathor" Gee.
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

View File

@ -1,19 +1,19 @@
[![License:Zlib](https://img.shields.io/badge/License-Zlib-brightgreen.svg)](https://opensource.org/licenses/Zlib)
![Minimum Rust Version](https://img.shields.io/badge/Min%20Rust-1.34-green.svg)
[![crates.io](https://img.shields.io/crates/v/tinyvec.svg)](https://crates.io/crates/tinyvec)
[![docs.rs](https://docs.rs/tinyvec/badge.svg)](https://docs.rs/tinyvec/)
![Unsafe-Zero-Percent](https://img.shields.io/badge/Unsafety-0%25-brightgreen.svg)
# tinyvec
A 100% safe crate of vec-like types. `#![forbid(unsafe_code)]`
Main types are as follows:
* `ArrayVec` is an array-backed vec-like data structure. It panics on overflow.
* `SliceVec` is the same deal, but using a `&mut [T]`.
* `TinyVec` (`alloc` feature) is an enum that's either an `Inline(ArrayVec)` or a `Heap(Vec)`. If a `TinyVec` is `Inline` and would overflow it automatically transitions to `Heap` and continues whatever it was doing.
To attain this "100% safe code" status there is one compromise: the element type of the vecs must implement `Default`.
For more details, please see [the docs.rs documentation](https://docs.rs/tinyvec/)
[![License:Zlib](https://img.shields.io/badge/License-Zlib-brightgreen.svg)](https://opensource.org/licenses/Zlib)
![Minimum Rust Version](https://img.shields.io/badge/Min%20Rust-1.34-green.svg)
[![crates.io](https://img.shields.io/crates/v/tinyvec.svg)](https://crates.io/crates/tinyvec)
[![docs.rs](https://docs.rs/tinyvec/badge.svg)](https://docs.rs/tinyvec/)
![Unsafe-Zero-Percent](https://img.shields.io/badge/Unsafety-0%25-brightgreen.svg)
# tinyvec
A 100% safe crate of vec-like types. `#![forbid(unsafe_code)]`
Main types are as follows:
* `ArrayVec` is an array-backed vec-like data structure. It panics on overflow.
* `SliceVec` is the same deal, but using a `&mut [T]`.
* `TinyVec` (`alloc` feature) is an enum that's either an `Inline(ArrayVec)` or a `Heap(Vec)`. If a `TinyVec` is `Inline` and would overflow it automatically transitions to `Heap` and continues whatever it was doing.
To attain this "100% safe code" status there is one compromise: the element type of the vecs must implement `Default`.
For more details, please see [the docs.rs documentation](https://docs.rs/tinyvec/)

View File

@ -1,52 +1,52 @@
use criterion::{criterion_group, criterion_main, Criterion};
use tinyvec::tiny_vec;
fn bench_tinyvec_macro(c: &mut Criterion) {
let mut g = c.benchmark_group("tinyvec_macro");
g.bench_function("0 of 32", |b| {
b.iter(|| tiny_vec!([u8; 32]));
});
g.bench_function("16 of 32", |b| {
b.iter(|| {
tiny_vec!([u8; 32]=>
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
)
});
});
g.bench_function("32 of 32", |b| {
b.iter(|| {
tiny_vec!([u8; 32]=>
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,
)
});
});
g.bench_function("33 of 32", |b| {
b.iter(|| {
tiny_vec!([u8; 32]=>
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,
33,
)
});
});
g.bench_function("64 of 32", |b| {
b.iter(|| {
tiny_vec!([u8; 32]=>
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,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
)
});
});
}
criterion_group!(benches, bench_tinyvec_macro);
criterion_main!(benches);
use criterion::{criterion_group, criterion_main, Criterion};
use tinyvec::tiny_vec;
fn bench_tinyvec_macro(c: &mut Criterion) {
let mut g = c.benchmark_group("tinyvec_macro");
g.bench_function("0 of 32", |b| {
b.iter(|| tiny_vec!([u8; 32]));
});
g.bench_function("16 of 32", |b| {
b.iter(|| {
tiny_vec!([u8; 32]=>
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
)
});
});
g.bench_function("32 of 32", |b| {
b.iter(|| {
tiny_vec!([u8; 32]=>
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,
)
});
});
g.bench_function("33 of 32", |b| {
b.iter(|| {
tiny_vec!([u8; 32]=>
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,
33,
)
});
});
g.bench_function("64 of 32", |b| {
b.iter(|| {
tiny_vec!([u8; 32]=>
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,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
)
});
});
}
criterion_group!(benches, bench_tinyvec_macro);
criterion_main!(benches);

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,30 @@
import os
import os.path
import json
comparisons = []
for (root, _dirs, files) in os.walk('target/criterion'):
for file in files:
if file == 'estimates.json' and root.endswith(
'new') and 'TinyVec' in root:
path = os.path.join(root, file)
bench_name = path.split('/')[3]
tinyvec_time = json.load(open(path))['mean']['point_estimate']
path = path.replace('TinyVec', 'SmallVec')
smallvec_time = json.load(open(path))['mean']['point_estimate']
comparisons.append((bench_name, tinyvec_time / smallvec_time))
comparisons.sort(key=lambda x: x[1])
longest_name = max(len(c[0]) for c in comparisons)
for (name, ratio) in comparisons:
# Undo the criterion name mangling
name = name.replace('_[', '<[')
name = name.replace(']___', ']>::')
name = name.ljust(longest_name)
print(f"{name} {ratio:.2f}")
import os
import os.path
import json
comparisons = []
for (root, _dirs, files) in os.walk('target/criterion'):
for file in files:
if file == 'estimates.json' and root.endswith(
'new') and 'TinyVec' in root:
path = os.path.join(root, file)
bench_name = path.split('/')[3]
tinyvec_time = json.load(open(path))['mean']['point_estimate']
path = path.replace('TinyVec', 'SmallVec')
smallvec_time = json.load(open(path))['mean']['point_estimate']
comparisons.append((bench_name, tinyvec_time / smallvec_time))
comparisons.sort(key=lambda x: x[1])
longest_name = max(len(c[0]) for c in comparisons)
for (name, ratio) in comparisons:
# Undo the criterion name mangling
name = name.replace('_[', '<[')
name = name.replace(']___', ']>::')
name = name.ljust(longest_name)
print(f"{name} {ratio:.2f}")

View File

@ -1,53 +1,53 @@
#!/usr/bin/env bash
gen_impl() {
local len=$1
cat <<-END
impl<T: Default> Array for [T; $len] {
type Item = T;
const CAPACITY: usize = $len;
#[inline(always)]
#[must_use]
fn as_slice(&self) -> &[T] {
&*self
}
#[inline(always)]
#[must_use]
fn as_slice_mut(&mut self) -> &mut [T] {
&mut *self
}
#[inline(always)]
fn default() -> Self {
[
$(for ((i = 0; i < $len; i += 6))
do
echo -n ' '
for ((j = 0; j < 6 && j + i < $len; j++))
do
echo -n ' T::default(),'
done
echo
done)
]
}
}
END
}
cat <<-END
// Generated file, to regenerate run
// ./gen-array-impls.sh > src/array/generated_impl.rs
// from the repo root
use super::Array;
$(for ((i = 0; i <= 33; i++)); do gen_impl $i; done)
$(for ((i = 64; i <= 4096; i *= 2)); do gen_impl $i; done)
END
# vim: noet
#!/usr/bin/env bash
gen_impl() {
local len=$1
cat <<-END
impl<T: Default> Array for [T; $len] {
type Item = T;
const CAPACITY: usize = $len;
#[inline(always)]
#[must_use]
fn as_slice(&self) -> &[T] {
&*self
}
#[inline(always)]
#[must_use]
fn as_slice_mut(&mut self) -> &mut [T] {
&mut *self
}
#[inline(always)]
fn default() -> Self {
[
$(for ((i = 0; i < $len; i += 6))
do
echo -n ' '
for ((j = 0; j < 6 && j + i < $len; j++))
do
echo -n ' T::default(),'
done
echo
done)
]
}
}
END
}
cat <<-END
// Generated file, to regenerate run
// ./gen-array-impls.sh > src/array/generated_impl.rs
// from the repo root
use super::Array;
$(for ((i = 0; i <= 33; i++)); do gen_impl $i; done)
$(for ((i = 64; i <= 4096; i *= 2)); do gen_impl $i; done)
END
# vim: noet

View File

@ -1,14 +1,14 @@
# Stable
edition = "2018"
fn_args_layout = "Compressed"
max_width = 80
tab_spaces = 2
use_field_init_shorthand = true
use_try_shorthand = true
use_small_heuristics = "Max"
# Unstable
format_code_in_doc_comments = true
wrap_comments = true
imports_granularity="Crate"
# Stable
edition = "2018"
fn_args_layout = "Compressed"
max_width = 80
tab_spaces = 2
use_field_init_shorthand = true
use_try_shorthand = true
use_small_heuristics = "Max"
# Unstable
format_code_in_doc_comments = true
wrap_comments = true
imports_granularity="Crate"

View File

@ -1,303 +1,303 @@
#![cfg(feature = "experimental_array_set")]
// This was contributed by user `dhardy`! Big thanks.
use super::{take, Array};
use core::{
borrow::Borrow,
fmt,
mem::swap,
ops::{AddAssign, SubAssign},
};
/// Error resulting from attempting to insert into a full array
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct InsertError;
// TODO(when std): impl std::error::Error for InsertError {}
impl fmt::Display for InsertError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ArraySet: insertion failed")
}
}
/// An array-backed set
///
/// This set supports `O(n)` operations and has a fixed size, thus may fail to
/// insert items. The potential advantage is a *really* small size.
///
/// The set is backed by an array of type `A` and indexed by type `L`.
/// The item type must support `Default`.
/// Due to restrictions, `L` may be only `u8` or `u16`.
#[derive(Clone, Debug, Default)]
pub struct ArraySet<A: Array, L> {
arr: A,
len: L,
}
impl<A: Array + Default, L: From<u8>> ArraySet<A, L> {
/// Constructs a new, empty, set
#[inline]
pub fn new() -> Self {
ArraySet { arr: Default::default(), len: 0.into() }
}
}
impl<A: Array, L: Copy + Into<usize>> ArraySet<A, L> {
/// Constructs a new set from given inputs
///
/// Panics if `len> arr.len()`.
#[inline]
pub fn from(arr: A, len: L) -> Self {
if len.into() > A::CAPACITY {
panic!("ArraySet::from(array, len): len > array.len()");
}
ArraySet { arr, len }
}
}
impl<A: Array, L> ArraySet<A, L>
where
L: Copy + PartialEq + From<u8> + Into<usize>,
{
/// Returns the fixed capacity of the set
#[inline]
pub fn capacity(&self) -> usize {
A::CAPACITY
}
/// Returns the number of elements in the set
#[inline]
pub fn len(&self) -> usize {
self.len.into()
}
/// Returns true when the set contains no elements
#[inline]
pub fn is_empty(&self) -> bool {
self.len == 0.into()
}
/// Removes all elements
#[inline]
pub fn clear(&mut self) {
self.len = 0.into();
}
/// Iterate over all contents
#[inline]
pub fn iter(&self) -> Iter<A::Item> {
Iter { a: self.arr.as_slice(), i: 0 }
}
}
impl<A: Array, L> ArraySet<A, L>
where
L: Copy + PartialOrd + AddAssign + SubAssign + From<u8> + Into<usize>,
{
/// Check whether the set contains `elt`
#[inline]
pub fn contains<Q: Eq + ?Sized>(&self, elt: &Q) -> bool
where
A::Item: Borrow<Q>,
{
self.get(elt).is_some()
}
/// Get a reference to a contained item matching `elt`
pub fn get<Q: Eq + ?Sized>(&self, elt: &Q) -> Option<&A::Item>
where
A::Item: Borrow<Q>,
{
let len: usize = self.len.into();
let arr = self.arr.as_slice();
for i in 0..len {
if arr[i].borrow() == elt {
return Some(&arr[i]);
}
}
None
}
/// Remove an item matching `elt`, if any
pub fn remove<Q: Eq + ?Sized>(&mut self, elt: &Q) -> Option<A::Item>
where
A::Item: Borrow<Q>,
{
let len: usize = self.len.into();
let arr = self.arr.as_slice_mut();
for i in 0..len {
if arr[i].borrow() == elt {
let l1 = len - 1;
if i < l1 {
arr.swap(i, l1);
}
self.len -= L::from(1);
return Some(take(&mut arr[l1]));
}
}
None
}
/// Remove any items for which `f(item) == false`
pub fn retain<F>(&mut self, mut f: F)
where
F: FnMut(&A::Item) -> bool,
{
let mut len = self.len;
let arr = self.arr.as_slice_mut();
let mut i = 0;
while i < len.into() {
if !f(&arr[i]) {
len -= L::from(1);
if i < len.into() {
arr.swap(i, len.into());
}
} else {
i += 1;
}
}
self.len = len;
}
}
impl<A: Array, L> ArraySet<A, L>
where
A::Item: Eq,
L: Copy + PartialOrd + AddAssign + SubAssign + From<u8> + Into<usize>,
{
/// Insert an item
///
/// Due to the fixed size of the backing array, insertion may fail.
#[inline]
pub fn insert(&mut self, elt: A::Item) -> Result<bool, InsertError> {
if self.contains(&elt) {
return Ok(false);
}
let len = self.len.into();
let arr = self.arr.as_slice_mut();
if len >= arr.len() {
return Err(InsertError);
}
arr[len] = elt;
self.len += L::from(1);
Ok(true)
}
/* Hits borrow checker
pub fn get_or_insert(&mut self, elt: A::Item) -> Result<&A::Item, InsertError> {
if let Some(r) = self.get(&elt) {
return Ok(r);
}
self.insert(elt)?;
let len: usize = self.len.into();
Ok(&self.arr.as_slice()[len - 1])
}
*/
/// Replace an item matching `elt` with `elt`, or insert `elt`
///
/// Returns the replaced item, if any. Fails when there is no matching item
/// and the backing array is full, preventing insertion.
pub fn replace(
&mut self,
mut elt: A::Item,
) -> Result<Option<A::Item>, InsertError> {
let len: usize = self.len.into();
let arr = self.arr.as_slice_mut();
for i in 0..len {
if arr[i] == elt {
swap(&mut arr[i], &mut elt);
return Ok(Some(elt));
}
}
if len >= arr.len() {
return Err(InsertError);
}
arr[len] = elt;
self.len += L::from(1);
Ok(None)
}
}
/// Type returned by [`ArraySet::iter`]
pub struct Iter<'a, T> {
a: &'a [T],
i: usize,
}
impl<'a, T> ExactSizeIterator for Iter<'a, T> {
#[inline]
fn len(&self) -> usize {
self.a.len() - self.i
}
}
impl<'a, T> Iterator for Iter<'a, T> {
type Item = &'a T;
#[inline]
fn next(&mut self) -> Option<Self::Item> {
if self.i < self.a.len() {
let i = self.i;
self.i += 1;
Some(&self.a[i])
} else {
None
}
}
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let len = self.len();
(len, Some(len))
}
}
#[cfg(test)]
mod test {
use super::*;
use core::mem::size_of;
#[test]
fn test_size() {
assert_eq!(size_of::<ArraySet<[i8; 7], u8>>(), 8);
}
#[test]
fn test() {
let mut set: ArraySet<[i8; 7], u8> = ArraySet::new();
assert_eq!(set.capacity(), 7);
assert_eq!(set.insert(1), Ok(true));
assert_eq!(set.insert(5), Ok(true));
assert_eq!(set.insert(6), Ok(true));
assert_eq!(set.len(), 3);
assert_eq!(set.insert(5), Ok(false));
assert_eq!(set.len(), 3);
assert_eq!(set.replace(1), Ok(Some(1)));
assert_eq!(set.replace(2), Ok(None));
assert_eq!(set.len(), 4);
assert_eq!(set.insert(3), Ok(true));
assert_eq!(set.insert(4), Ok(true));
assert_eq!(set.insert(7), Ok(true));
assert_eq!(set.insert(8), Err(InsertError));
assert_eq!(set.len(), 7);
assert_eq!(set.replace(9), Err(InsertError));
assert_eq!(set.remove(&3), Some(3));
assert_eq!(set.len(), 6);
set.retain(|x| *x == 3 || *x == 6);
assert_eq!(set.len(), 1);
assert!(!set.contains(&3));
assert!(set.contains(&6));
}
}
#![cfg(feature = "experimental_array_set")]
// This was contributed by user `dhardy`! Big thanks.
use super::{take, Array};
use core::{
borrow::Borrow,
fmt,
mem::swap,
ops::{AddAssign, SubAssign},
};
/// Error resulting from attempting to insert into a full array
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct InsertError;
// TODO(when std): impl std::error::Error for InsertError {}
impl fmt::Display for InsertError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ArraySet: insertion failed")
}
}
/// An array-backed set
///
/// This set supports `O(n)` operations and has a fixed size, thus may fail to
/// insert items. The potential advantage is a *really* small size.
///
/// The set is backed by an array of type `A` and indexed by type `L`.
/// The item type must support `Default`.
/// Due to restrictions, `L` may be only `u8` or `u16`.
#[derive(Clone, Debug, Default)]
pub struct ArraySet<A: Array, L> {
arr: A,
len: L,
}
impl<A: Array + Default, L: From<u8>> ArraySet<A, L> {
/// Constructs a new, empty, set
#[inline]
pub fn new() -> Self {
ArraySet { arr: Default::default(), len: 0.into() }
}
}
impl<A: Array, L: Copy + Into<usize>> ArraySet<A, L> {
/// Constructs a new set from given inputs
///
/// Panics if `len> arr.len()`.
#[inline]
pub fn from(arr: A, len: L) -> Self {
if len.into() > A::CAPACITY {
panic!("ArraySet::from(array, len): len > array.len()");
}
ArraySet { arr, len }
}
}
impl<A: Array, L> ArraySet<A, L>
where
L: Copy + PartialEq + From<u8> + Into<usize>,
{
/// Returns the fixed capacity of the set
#[inline]
pub fn capacity(&self) -> usize {
A::CAPACITY
}
/// Returns the number of elements in the set
#[inline]
pub fn len(&self) -> usize {
self.len.into()
}
/// Returns true when the set contains no elements
#[inline]
pub fn is_empty(&self) -> bool {
self.len == 0.into()
}
/// Removes all elements
#[inline]
pub fn clear(&mut self) {
self.len = 0.into();
}
/// Iterate over all contents
#[inline]
pub fn iter(&self) -> Iter<A::Item> {
Iter { a: self.arr.as_slice(), i: 0 }
}
}
impl<A: Array, L> ArraySet<A, L>
where
L: Copy + PartialOrd + AddAssign + SubAssign + From<u8> + Into<usize>,
{
/// Check whether the set contains `elt`
#[inline]
pub fn contains<Q: Eq + ?Sized>(&self, elt: &Q) -> bool
where
A::Item: Borrow<Q>,
{
self.get(elt).is_some()
}
/// Get a reference to a contained item matching `elt`
pub fn get<Q: Eq + ?Sized>(&self, elt: &Q) -> Option<&A::Item>
where
A::Item: Borrow<Q>,
{
let len: usize = self.len.into();
let arr = self.arr.as_slice();
for i in 0..len {
if arr[i].borrow() == elt {
return Some(&arr[i]);
}
}
None
}
/// Remove an item matching `elt`, if any
pub fn remove<Q: Eq + ?Sized>(&mut self, elt: &Q) -> Option<A::Item>
where
A::Item: Borrow<Q>,
{
let len: usize = self.len.into();
let arr = self.arr.as_slice_mut();
for i in 0..len {
if arr[i].borrow() == elt {
let l1 = len - 1;
if i < l1 {
arr.swap(i, l1);
}
self.len -= L::from(1);
return Some(take(&mut arr[l1]));
}
}
None
}
/// Remove any items for which `f(item) == false`
pub fn retain<F>(&mut self, mut f: F)
where
F: FnMut(&A::Item) -> bool,
{
let mut len = self.len;
let arr = self.arr.as_slice_mut();
let mut i = 0;
while i < len.into() {
if !f(&arr[i]) {
len -= L::from(1);
if i < len.into() {
arr.swap(i, len.into());
}
} else {
i += 1;
}
}
self.len = len;
}
}
impl<A: Array, L> ArraySet<A, L>
where
A::Item: Eq,
L: Copy + PartialOrd + AddAssign + SubAssign + From<u8> + Into<usize>,
{
/// Insert an item
///
/// Due to the fixed size of the backing array, insertion may fail.
#[inline]
pub fn insert(&mut self, elt: A::Item) -> Result<bool, InsertError> {
if self.contains(&elt) {
return Ok(false);
}
let len = self.len.into();
let arr = self.arr.as_slice_mut();
if len >= arr.len() {
return Err(InsertError);
}
arr[len] = elt;
self.len += L::from(1);
Ok(true)
}
/* Hits borrow checker
pub fn get_or_insert(&mut self, elt: A::Item) -> Result<&A::Item, InsertError> {
if let Some(r) = self.get(&elt) {
return Ok(r);
}
self.insert(elt)?;
let len: usize = self.len.into();
Ok(&self.arr.as_slice()[len - 1])
}
*/
/// Replace an item matching `elt` with `elt`, or insert `elt`
///
/// Returns the replaced item, if any. Fails when there is no matching item
/// and the backing array is full, preventing insertion.
pub fn replace(
&mut self,
mut elt: A::Item,
) -> Result<Option<A::Item>, InsertError> {
let len: usize = self.len.into();
let arr = self.arr.as_slice_mut();
for i in 0..len {
if arr[i] == elt {
swap(&mut arr[i], &mut elt);
return Ok(Some(elt));
}
}
if len >= arr.len() {
return Err(InsertError);
}
arr[len] = elt;
self.len += L::from(1);
Ok(None)
}
}
/// Type returned by [`ArraySet::iter`]
pub struct Iter<'a, T> {
a: &'a [T],
i: usize,
}
impl<'a, T> ExactSizeIterator for Iter<'a, T> {
#[inline]
fn len(&self) -> usize {
self.a.len() - self.i
}
}
impl<'a, T> Iterator for Iter<'a, T> {
type Item = &'a T;
#[inline]
fn next(&mut self) -> Option<Self::Item> {
if self.i < self.a.len() {
let i = self.i;
self.i += 1;
Some(&self.a[i])
} else {
None
}
}
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let len = self.len();
(len, Some(len))
}
}
#[cfg(test)]
mod test {
use super::*;
use core::mem::size_of;
#[test]
fn test_size() {
assert_eq!(size_of::<ArraySet<[i8; 7], u8>>(), 8);
}
#[test]
fn test() {
let mut set: ArraySet<[i8; 7], u8> = ArraySet::new();
assert_eq!(set.capacity(), 7);
assert_eq!(set.insert(1), Ok(true));
assert_eq!(set.insert(5), Ok(true));
assert_eq!(set.insert(6), Ok(true));
assert_eq!(set.len(), 3);
assert_eq!(set.insert(5), Ok(false));
assert_eq!(set.len(), 3);
assert_eq!(set.replace(1), Ok(Some(1)));
assert_eq!(set.replace(2), Ok(None));
assert_eq!(set.len(), 4);
assert_eq!(set.insert(3), Ok(true));
assert_eq!(set.insert(4), Ok(true));
assert_eq!(set.insert(7), Ok(true));
assert_eq!(set.insert(8), Err(InsertError));
assert_eq!(set.len(), 7);
assert_eq!(set.replace(9), Err(InsertError));
assert_eq!(set.remove(&3), Some(3));
assert_eq!(set.len(), 6);
set.retain(|x| *x == 3 || *x == 6);
assert_eq!(set.len(), 1);
assert!(!set.contains(&3));
assert!(set.contains(&6));
}
}

View File

@ -1,48 +1,48 @@
/// A trait for types that are an array.
///
/// An "array", for our purposes, has the following properties:
/// * Owns some number of elements.
/// * The element type can be generic, but must implement [`Default`].
/// * The capacity is fixed at compile time, based on the implementing type.
/// * You can get a shared or mutable slice to the elements.
///
/// You are generally **not** expected to need to implement this yourself. It is
/// already implemented for all the major array lengths (`0..=32` and the powers
/// of 2 up to 4,096), or for all array lengths with the feature `rustc_1_55`.
///
/// **Additional lengths can easily be added upon request.**
///
/// ## Safety Reminder
///
/// Just a reminder: this trait is 100% safe, which means that `unsafe` code
/// **must not** rely on an instance of this trait being correct.
pub trait Array {
/// The type of the items in the thing.
type Item: Default;
/// The number of slots in the thing.
const CAPACITY: usize;
/// Gives a shared slice over the whole thing.
///
/// A correct implementation will return a slice with a length equal to the
/// `CAPACITY` value.
fn as_slice(&self) -> &[Self::Item];
/// Gives a unique slice over the whole thing.
///
/// A correct implementation will return a slice with a length equal to the
/// `CAPACITY` value.
fn as_slice_mut(&mut self) -> &mut [Self::Item];
/// Create a default-initialized instance of ourself, similar to the
/// [`Default`] trait, but implemented for the same range of sizes as
/// [`Array`].
fn default() -> Self;
}
#[cfg(feature = "rustc_1_55")]
mod const_generic_impl;
#[cfg(not(feature = "rustc_1_55"))]
mod generated_impl;
/// A trait for types that are an array.
///
/// An "array", for our purposes, has the following properties:
/// * Owns some number of elements.
/// * The element type can be generic, but must implement [`Default`].
/// * The capacity is fixed at compile time, based on the implementing type.
/// * You can get a shared or mutable slice to the elements.
///
/// You are generally **not** expected to need to implement this yourself. It is
/// already implemented for all the major array lengths (`0..=32` and the powers
/// of 2 up to 4,096), or for all array lengths with the feature `rustc_1_55`.
///
/// **Additional lengths can easily be added upon request.**
///
/// ## Safety Reminder
///
/// Just a reminder: this trait is 100% safe, which means that `unsafe` code
/// **must not** rely on an instance of this trait being correct.
pub trait Array {
/// The type of the items in the thing.
type Item: Default;
/// The number of slots in the thing.
const CAPACITY: usize;
/// Gives a shared slice over the whole thing.
///
/// A correct implementation will return a slice with a length equal to the
/// `CAPACITY` value.
fn as_slice(&self) -> &[Self::Item];
/// Gives a unique slice over the whole thing.
///
/// A correct implementation will return a slice with a length equal to the
/// `CAPACITY` value.
fn as_slice_mut(&mut self) -> &mut [Self::Item];
/// Create a default-initialized instance of ourself, similar to the
/// [`Default`] trait, but implemented for the same range of sizes as
/// [`Array`].
fn default() -> Self;
}
#[cfg(feature = "rustc_1_55")]
mod const_generic_impl;
#[cfg(not(feature = "rustc_1_55"))]
mod generated_impl;

Some files were not shown because too many files have changed in this diff Show More