mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 20:57:10 +00:00
Add (untested) ssz decode macro
This commit is contained in:
@@ -18,13 +18,21 @@ pub trait Encodable {
|
||||
fn ssz_append(&self, s: &mut SszStream);
|
||||
}
|
||||
|
||||
pub trait Decodable {
|
||||
type Decoded;
|
||||
|
||||
fn ssz_decode<T>(bytes: &[u8]) -> Result<Self::Decoded, DecodeError>;
|
||||
}
|
||||
|
||||
pub struct SszStream {
|
||||
buffer: Vec<u8>
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum DecodeError {
|
||||
OutOfBounds,
|
||||
TooShort,
|
||||
TooLong,
|
||||
}
|
||||
|
||||
impl SszStream {
|
||||
|
||||
Reference in New Issue
Block a user