Skip to content

Commit 629e25f

Browse files
authored
hybrid-array v0.1.0 (#764)
1 parent 4601ef2 commit 629e25f

File tree

5 files changed

+51
-14
lines changed

5 files changed

+51
-14
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hybrid-array/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## 0.1.0 (2022-05-07)
9+
- Initial release

hybrid-array/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hybrid-array"
3-
version = "0.0.0" # Also update html_root_url in lib.rs when bumping this
3+
version = "0.1.0" # Also update html_root_url in lib.rs when bumping this
44
description = """
55
Hybrid typenum-based and const generic array types designed to provide the
66
flexibility of typenum-based expressions while also allowing interoperability
@@ -9,8 +9,9 @@ and a transition path to const generics
99
authors = ["RustCrypto Developers"]
1010
license = "MIT OR Apache-2.0"
1111
documentation = "https://docs.rs/hybrid-array"
12-
repository = "https://github.com/RustCrypto/utils"
13-
categories = ["no-std"]
12+
repository = "https://github.com/RustCrypto/utils/tree/master/hybrid-array"
13+
categories = ["no-std", "data-structures"]
14+
keywords = ["generic-array"]
1415
readme = "README.md"
1516
edition = "2021"
1617
rust-version = "1.56"

hybrid-array/README.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,29 @@
22

33
[![crate][crate-image]][crate-link]
44
[![Docs][docs-image]][docs-link]
5+
[![Build Status][build-image]][build-link]
6+
[![Safety Dance][safety-image]][safety-link]
57
![Apache2/MIT licensed][license-image]
68
![Rust Version][rustc-image]
79
[![Project Chat][chat-image]][chat-link]
8-
[![Build Status][build-image]][build-link]
910

1011
Hybrid array type combining const generics with the expressiveness of
1112
[`typenum`]-based constraints, providing an alternative to [`generic-array`]
1213
and a incremental transition path to const generics.
1314

1415
[Documentation][docs-link]
1516

17+
## About
18+
19+
This crate uses `typenum` to enable the following features which aren't yet
20+
possible with the stable implementation of const generics:
21+
22+
- [#60551: Associated constants in traits can not be used in const generics][rust-issue-60551]
23+
- [#76560: Complex generic constants: `feature(generic_const_exprs)`][rust-issue-76560]
24+
25+
Internally the crate is built on const generics and provides traits which make
26+
it possible to convert between const generic types and `typenum` types.
27+
1628
## License
1729

1830
Licensed under either of:
@@ -30,18 +42,24 @@ dual licensed as above, without any additional terms or conditions.
3042

3143
[//]: # (badges)
3244

33-
[crate-image]: https://img.shields.io/crates/v/hybrid-array.svg
45+
[crate-image]: https://buildstats.info/crate/hybrid-array
3446
[crate-link]: https://crates.io/crates/hybrid-array
3547
[docs-image]: https://docs.rs/hybrid-array/badge.svg
3648
[docs-link]: https://docs.rs/hybrid-array/
49+
[build-image]: https://github.com/RustCrypto/utils/workflows/hybrid-array/badge.svg?branch=master&event=push
50+
[build-link]: https://github.com/RustCrypto/utils/actions/workflows/hybrid-array.yml
51+
[safety-image]: https://img.shields.io/badge/unsafe-forbidden-success.svg
52+
[safety-link]: https://github.com/rust-secure-code/safety-dance/
3753
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
3854
[rustc-image]: https://img.shields.io/badge/rustc-1.56+-blue.svg
3955
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
4056
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260052-utils
41-
[build-image]: https://github.com/RustCrypto/utils/workflows/hybrid-array/badge.svg?branch=master&event=push
42-
[build-link]: https://github.com/RustCrypto/utils/actions/workflows/hybrid-array.yml
4357

44-
[//]: # (general links)
58+
[//]: # (links)
4559

4660
[RustCrypto]: https://github.com/rustcrypto
4761
[RustCrypto/utils#378]: https://github.com/RustCrypto/utils/issues/378
62+
[`typenum`]: https://github.com/paholg/typenum
63+
[`generic-array`]: https://github.com/fizyk20/generic-array
64+
[rust-issue-60551]: https://github.com/rust-lang/rust/issues/60551
65+
[rust-issue-76560]: https://github.com/rust-lang/rust/issues/76560

hybrid-array/src/lib.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,26 @@
33
#![doc = include_str!("../README.md")]
44
#![doc(
55
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
6-
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
7-
html_root_url = "https://docs.rs/hybrid-array/0.0.0"
6+
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg"
7+
)]
8+
#![forbid(unsafe_code)]
9+
#![warn(
10+
clippy::cast_lossless,
11+
clippy::cast_possible_truncation,
12+
clippy::cast_possible_wrap,
13+
clippy::cast_precision_loss,
14+
clippy::cast_sign_loss,
15+
clippy::checked_conversions,
16+
clippy::implicit_saturating_sub,
17+
clippy::integer_arithmetic,
18+
clippy::panic,
19+
clippy::panic_in_result_fn,
20+
clippy::unwrap_used,
21+
missing_docs,
22+
rust_2018_idioms,
23+
unused_lifetimes,
24+
unused_qualifications
825
)]
9-
#![forbid(unsafe_code, clippy::unwrap_used)]
10-
#![warn(missing_docs, rust_2018_idioms)]
1126

1227
pub use typenum;
1328

@@ -60,7 +75,7 @@ pub trait ArrayOps<T, const N: usize>:
6075
let mut idx = 0;
6176
Self::from_core_array([(); N].map(|_| {
6277
let res = cb(idx);
63-
idx += 1;
78+
idx = idx.saturating_add(1); // TODO(tarcieri): better overflow handling?
6479
res
6580
}))
6681
}

0 commit comments

Comments
 (0)