CustomDecoder

Trait CustomDecoder 

Source
pub trait CustomDecoder: Sized {
    // Provided methods
    fn encode_from_bytes(
        data: &Vec<u8>,
        writer: &mut Vec<u8>,
        _proposal_type: &ProposalType,
    ) -> Result<(), Error> { ... }
    fn decode_from_bytes(
        reader: &mut &[u8],
        _proposal_type: &ProposalType,
    ) -> Result<Vec<u8>, Error> { ... }
    fn encoded_byte_len(data: &Vec<u8>, _proposal_type: &ProposalType) -> usize { ... }
}
Expand description

Encode/Decode for the data field of CustomProposal. This allows specialization over the decoding based on the ProposalType, if users want to use an encoding other than the default bytes vector (in particular, if users want the CustomProposal wrapper to be hidden in the encoding, so the underlying custom proposal can be decoded directly).

Provided Methods§

Source

fn encode_from_bytes( data: &Vec<u8>, writer: &mut Vec<u8>, _proposal_type: &ProposalType, ) -> Result<(), Error>

Source

fn decode_from_bytes( reader: &mut &[u8], _proposal_type: &ProposalType, ) -> Result<Vec<u8>, Error>

Source

fn encoded_byte_len(data: &Vec<u8>, _proposal_type: &ProposalType) -> usize

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§