Skip to content

Commit 4ff54f7

Browse files
authored
crypto-bigint: additional ArrayEncoding::ByteSize bounds (#462)
Matches the previous bounds used by `elliptic_curve::FieldSize` so we can easily migrate the `elliptic-curve` crate to use this as the basis of all `ArrayLength` computations.
1 parent 01c945e commit 4ff54f7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crypto-bigint/src/array.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Interop support for `generic-array`
22
3-
use generic_array::{ArrayLength, GenericArray};
3+
use core::ops::Add;
4+
use generic_array::{typenum::Unsigned, ArrayLength, GenericArray};
45

56
/// Alias for a byte array whose size is defined by [`ArrayEncoding::ByteSize`].
67
#[cfg_attr(docsrs, doc(cfg(feature = "generic-array")))]
@@ -10,7 +11,7 @@ pub type ByteArray<T> = GenericArray<u8, <T as ArrayEncoding>::ByteSize>;
1011
#[cfg_attr(docsrs, doc(cfg(feature = "generic-array")))]
1112
pub trait ArrayEncoding: Sized {
1213
/// Size of a byte array which encodes a big integer.
13-
type ByteSize: ArrayLength<u8>;
14+
type ByteSize: ArrayLength<u8> + Add + Eq + Ord + Unsigned;
1415

1516
/// Deserialize from a big-endian byte array.
1617
fn from_be_byte_array(bytes: &ByteArray<Self>) -> Self;

0 commit comments

Comments
 (0)