commonware_utils/sequence/
mod.rs1use commonware_codec::{Codec, EncodeFixed};
2use core::{
3 cmp::{Ord, PartialOrd},
4 error::Error as CoreError,
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;
16pub mod u32;
17pub use u32::U32;
18
19#[derive(Error, Debug, PartialEq)]
21pub enum Error<E: CoreError + Send + Sync + 'static> {
22 #[error("invalid bytes")]
23 InsufficientBytes,
24 #[error("other: {0}")]
25 Other(E),
26}
27
28pub trait Span:
34 Clone
35 + Send
36 + Sync
37 + 'static
38 + Eq
39 + PartialEq
40 + Ord
41 + PartialOrd
42 + Debug
43 + Hash
44 + Display
45 + Codec<Cfg = ()>
46{
47}
48
49pub trait Array: Span + EncodeFixed + AsRef<[u8]> + Deref<Target = [u8]> {}