2019-05-04 04:11:48 +00:00
|
|
|
mod decode;
|
|
|
|
mod encode;
|
2019-05-13 02:33:59 +00:00
|
|
|
mod macros;
|
2019-02-14 01:09:18 +00:00
|
|
|
|
2019-05-10 06:37:00 +00:00
|
|
|
pub use decode::{
|
|
|
|
impls::decode_list_of_variable_length_items, Decodable, DecodeError, SszDecoderBuilder,
|
|
|
|
};
|
2019-05-05 23:26:58 +00:00
|
|
|
pub use encode::{Encodable, SszEncoder};
|
2019-02-14 01:09:18 +00:00
|
|
|
|
2019-05-04 04:11:48 +00:00
|
|
|
pub const BYTES_PER_LENGTH_OFFSET: usize = 4;
|
2019-05-06 01:51:50 +00:00
|
|
|
pub const MAX_LENGTH_VALUE: usize = (1 << (BYTES_PER_LENGTH_OFFSET * 8)) - 1;
|
2019-02-14 01:09:18 +00:00
|
|
|
|
|
|
|
/// Convenience function to SSZ encode an object supporting ssz::Encode.
|
2019-05-05 23:26:58 +00:00
|
|
|
///
|
|
|
|
/// Equivalent to `val.as_ssz_bytes()`.
|
2019-02-14 01:09:18 +00:00
|
|
|
pub fn ssz_encode<T>(val: &T) -> Vec<u8>
|
|
|
|
where
|
|
|
|
T: Encodable,
|
|
|
|
{
|
2019-05-05 23:26:58 +00:00
|
|
|
val.as_ssz_bytes()
|
2019-02-14 01:09:18 +00:00
|
|
|
}
|