crypto_bigint_syncless/
array.rs1use crate::{Encoding, Integer};
4use core::ops::Add;
5use hybrid_array::{Array, ArraySize, typenum::Unsigned};
6
7pub type ByteArray<T> = Array<u8, <T as ArrayEncoding>::ByteSize>;
9
10pub trait ArrayEncoding: Encoding {
12 type ByteSize: ArraySize + Add + Eq + Ord + Unsigned;
14
15 fn from_be_byte_array(bytes: ByteArray<Self>) -> Self;
17
18 fn from_le_byte_array(bytes: ByteArray<Self>) -> Self;
20
21 fn to_be_byte_array(&self) -> ByteArray<Self>;
23
24 fn to_le_byte_array(&self) -> ByteArray<Self>;
26}
27
28pub trait ArrayDecoding {
30 type Output: ArrayEncoding + Integer;
32
33 fn into_uint_be(self) -> Self::Output;
35
36 fn into_uint_le(self) -> Self::Output;
38}