commonware_utils/array/
mod.rs1use commonware_codec::{Decode, EncodeFixed};
2use std::{
3 cmp::{Ord, PartialOrd},
4 error::Error as StdError,
5 fmt::{Debug, Display},
6 hash::Hash,
7 ops::Deref,
8};
9use thiserror::Error;
10
11pub mod fixed_bytes;
12pub use fixed_bytes::FixedBytes;
13pub mod u64;
14pub use u64::U64;
15pub mod prefixed_u64;
16
17#[derive(Error, Debug, PartialEq)]
19pub enum Error<E: StdError + Send + Sync + 'static> {
20 #[error("invalid bytes")]
21 InsufficientBytes,
22 #[error("other: {0}")]
23 Other(E),
24}
25
26pub trait Array:
34 Clone
35 + Send
36 + Sync
37 + 'static
38 + Eq
39 + PartialEq
40 + Ord
41 + PartialOrd
42 + Debug
43 + Hash
44 + Display
45 + AsRef<[u8]>
46 + Deref<Target = [u8]>
47 + Decode<Cfg = ()>
48 + EncodeFixed
49{
50}