1use crate::{
2 decode::Decode,
3 encode::Encode,
4};
5
6impl Encode for bool {
7 fn encode(&self) -> Vec<u8> {
8 let mut buf = vec![0u8; 32];
9 buf[31] = if *self { 1 } else { 0 };
10 buf
11 }
12}
13
14impl<'a> Decode<'a> for bool {
15 fn decode(buf: &'a [u8]) -> Self {
16 buf[31] == 1
17 }
18}