You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: rlp.rs
    path of file: ./repos/akula/src/p2p/types
    
    the code of the file until where you have to start completion: use crate::{
    models::{BlockNumber, H256},
    p2p::types::{BlockId, Message},
};
use fastrlp::*;

impl Decodable for BlockId {
    fn decode(buf: &mut &[u8]) -> Result<Self, DecodeError> {
        if buf.len() == 32 {
            Ok(BlockId::Hash(<H256 as Decodable>::decode(buf)?))
        } else {
            Ok(BlockId::Number(<BlockNumber as Decodable>::decode(buf)?))
        }
    }
}

impl Encoda
    
    fn encode(&self, out: &mut dyn BufMut) {
        match *self {
            Message::NewBlockHashes(ref value) => value.encode(out),
            Message::GetBlockHeaders(ref value) => value.encode(out),
            Message::GetBlockBodies(ref value) => value.encode(out),
            Message::BlockBodies(ref value) => value.encode(out),
            Message::BlockHeaders(ref value) => value.encode(out),
            Message::NewBlock(ref value) => value.encode(out),
            Message::NewPooledTransactionHashes(ref value) => value.encode(out),
            Message::Transactions(ref value) => value.encode(out),
            Message::GetPooledTransactions(ref value) => value.encode(out),
            Message::PooledTransactions(ref value) => value.encode(out),
        }
    }