Trait alloy_eips::eip7685::Decodable7685

source ·
pub trait Decodable7685: Sized {
    // Required method
    fn typed_decode(ty: u8, buf: &mut &[u8]) -> Result<Self, Eip7685Error>;

    // Provided methods
    fn extract_type_byte(buf: &mut &[u8]) -> Option<u8> { ... }
    fn decode_7685(buf: &mut &[u8]) -> Result<Self, Eip7685Error> { ... }
}
Expand description

Decoding trait for EIP-7685 requests. The trait should be implemented for an envelope that wraps each possible request type.

Required Methods§

source

fn typed_decode(ty: u8, buf: &mut &[u8]) -> Result<Self, Eip7685Error>

Decode the appropriate variant, based on the request type.

This function is invoked by Self::decode_7685 with the type byte, and the tail of the buffer.

§Note

This should be a simple match block that invokes an inner type’s decoder. The decoder is request type dependent.

Provided Methods§

source

fn extract_type_byte(buf: &mut &[u8]) -> Option<u8>

Extract the type byte from the buffer, if any. The type byte is the first byte.

source

fn decode_7685(buf: &mut &[u8]) -> Result<Self, Eip7685Error>

Decode an EIP-7685 request into a concrete instance

Object Safety§

This trait is not object safe.

Implementors§