Skip to content

Commit

Permalink
Feature gate extra-sizes (#58)
Browse files Browse the repository at this point in the history
Allows more sizes to be added under `extra-sizes` without impacting
baseline compile times (i.e. usable for most RustCrypto projects aside
from post-quantum ones that require larger sizes)
  • Loading branch information
tarcieri committed Mar 4, 2024
1 parent 513ae14 commit 6ab15ae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/hybrid-array.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- run: cargo build --no-default-features --target ${{ matrix.target }}
- run: cargo build --no-default-features --target ${{ matrix.target }} --features extra-sizes

careful:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ zeroize = { version = "1.7", optional = true }

[features]
std = []
extra-sizes = []
3 changes: 2 additions & 1 deletion src/sizes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//!
//! - 0-256
//! - 272-1024 (multiples of 16)
//! - 1040-4096 (multiples of 32)
//! - when the `extra-sizes` feature is enabled: 1040-4096 (multiples of 32)

use super::{ArraySize, AssocArraySize};
use typenum::consts::*;
Expand Down Expand Up @@ -342,6 +342,7 @@ impl_array_sizes! {
/// Additional typenum size aliases beyond what are normally provided.
///
/// These are defined using their component bits rather than `Add` to avoid conflicting impls.
#[cfg(feature = "extra-sizes")]
pub mod extra_sizes {
use super::*;
use typenum::{UInt, UTerm};
Expand Down

0 comments on commit 6ab15ae

Please sign in to comment.