Skip to content

Commit

Permalink
Merge pull request #80 from fizyk20/more_lens
Browse files Browse the repository at this point in the history
Implement more lengths for `From`/`Into` behind a feature-flag
  • Loading branch information
novacrazy committed Jul 8, 2019
2 parents 989093d + 0b08cfc commit 8217a5b
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -3,12 +3,12 @@ script:
- cd $TRAVIS_BUILD_DIR
- cargo build
- cargo test
- cargo build --features serde
- cargo test --features serde
- cargo build --all-features
- cargo test --all-features
after_success: |-
[ $TRAVIS_BRANCH = master ] &&
[ $TRAVIS_PULL_REQUEST = false ] &&
cargo doc &&
cargo doc --all-features &&
echo "<meta http-equiv=refresh content=0;url=`echo $TRAVIS_REPO_SLUG | cut -d '/' -f 2`/index.html>" > target/doc/index.html &&
sudo pip install ghp-import &&
ghp-import -n target/doc &&
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,6 @@
* **`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
Expand Down
5 changes: 4 additions & 1 deletion Cargo.toml
@@ -1,7 +1,7 @@
[package]

name = "generic-array"
version = "0.13.1"
version = "0.13.2"
authors = [ "Bartłomiej Kamiński <fizyk20@gmail.com>", "Aaron Trent <novacrazy@gmail.com>" ]

description = "Generic types implementing functionality of arrays"
Expand All @@ -21,6 +21,9 @@ travis-ci = { repository = "fizyk20/generic-array" }
[lib]
name = "generic_array"

[features]
more_lengths = []

[dependencies]
typenum = "1.10"
serde = { version = "1.0", optional = true, default-features = false }
Expand Down
53 changes: 53 additions & 0 deletions src/impls.rs
Expand Up @@ -177,3 +177,56 @@ impl_from! {
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
}
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -51,7 +51,7 @@ mod hex;
mod impls;

#[cfg(feature = "serde")]
pub mod impl_serde;
mod impl_serde;

use core::iter::FromIterator;
use core::marker::PhantomData;
Expand Down

0 comments on commit 8217a5b

Please sign in to comment.