pub mod serde_utils;
pub mod length {
pub use ssz::{Fixed, Variable};
}
#[macro_use]
mod fixed_vector;
mod tree_hash;
mod variable_list;
#[cfg(feature = "context_deserialize")]
mod context_deserialize;
pub use fixed_vector::FixedVector;
pub use ssz::{BitList, BitVector, Bitfield};
pub use typenum;
pub use variable_list::VariableList;
#[cfg(feature = "runtime_types")]
mod runtime_types;
#[cfg(feature = "runtime_types")]
pub use runtime_types::{RuntimeFixedVector, RuntimeVariableList};
mod list_encoded_option;
pub use list_encoded_option::ListEncodedOption;
#[derive(PartialEq, Debug, Clone)]
pub enum Error {
OutOfBounds {
i: usize,
len: usize,
},
MissingLengthInformation,
ExcessBits,
InvalidByteCount {
given: usize,
expected: usize,
},
}
impl core::fmt::Display for Error {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Error::OutOfBounds { i, len } => {
write!(f, "Index out of bounds: index {}, length {}", i, len)
}
Error::MissingLengthInformation => {
write!(
f,
"BitList does not have a set bit, length cannot be determined"
)
}
Error::ExcessBits => {
write!(f, "BitList has excess bits set to true")
}
Error::InvalidByteCount { given, expected } => {
write!(
f,
"Invalid byte count: given {}, expected {}",
given, expected
)
}
}
}
}
impl core::error::Error for Error {}
impl From<std::convert::Infallible> for Error {
fn from(e: std::convert::Infallible) -> Self {
match e {}
}
}