mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 09:16:00 +00:00
Implement ssz::Decodable for u8
This commit is contained in:
@@ -36,6 +36,18 @@ impl_decodable_for_uint!(u32, 32);
|
|||||||
impl_decodable_for_uint!(u64, 64);
|
impl_decodable_for_uint!(u64, 64);
|
||||||
impl_decodable_for_uint!(usize, 64);
|
impl_decodable_for_uint!(usize, 64);
|
||||||
|
|
||||||
|
impl Decodable for u8 {
|
||||||
|
fn ssz_decode(bytes: &[u8], index: usize)
|
||||||
|
-> Result<(Self, usize), DecodeError>
|
||||||
|
{
|
||||||
|
if index >= bytes.len() {
|
||||||
|
Err(DecodeError::TooShort)
|
||||||
|
} else {
|
||||||
|
Ok((bytes[index], index + 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Decodable for H256 {
|
impl Decodable for H256 {
|
||||||
fn ssz_decode(bytes: &[u8], index: usize)
|
fn ssz_decode(bytes: &[u8], index: usize)
|
||||||
-> Result<(Self, usize), DecodeError>
|
-> Result<(Self, usize), DecodeError>
|
||||||
|
|||||||
Reference in New Issue
Block a user