solid-core 0.1.5

Core for the `solid` crate. Not intended to be used directly.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::{
    decode::Decode,
    encode::Encode,
};

impl Encode for bool {
    fn encode(&self) -> Vec<u8> {
        let mut buf = vec![0u8; 32];
        buf[31] = if *self { 1 } else { 0 };
        buf
    }
}

impl<'a> Decode<'a> for bool {
    fn decode(buf: &'a [u8]) -> Self {
        buf[31] == 1
    }
}