1pub mod heap_array;
2pub mod identifiers;
3
4use std::{fmt::Debug, ops::Add};
5
6pub use heap_array::{HeapArray, HeapMatrix};
7pub use identifiers::{PeerId, PeerIndex, PeerNumber, ProtocolInfo, SessionId};
8use subtle::Choice;
9use typenum::{NonZero, Unsigned, B1};
10
11pub trait Positive: Unsigned + NonZero + Debug + Eq + Send {
15 const SIZE: usize;
16}
17impl<T: Unsigned + NonZero + Debug + Eq + Send> Positive for T {
18 const SIZE: usize = <T as Unsigned>::USIZE;
19}
20
21pub trait NonNegative: Unsigned + Debug + Eq + Send {}
23impl<T: Unsigned + Debug + Eq + Send> NonNegative for T {}
24
25pub trait PositivePlusOne: Positive + Add<B1, Output: Positive> {}
28impl<T: Positive + Add<B1, Output: Positive>> PositivePlusOne for T {}
29
30pub trait ConditionallySelectable: Sized {
36 fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self;
43}
44
45impl<T: subtle::ConditionallySelectable> ConditionallySelectable for T {
46 #[inline]
47 fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self {
48 <T as subtle::ConditionallySelectable>::conditional_select(a, b, choice)
49 }
50}