Trait lightning::ln::wire::CustomMessageReader
source · pub trait CustomMessageReader {
type CustomMessage: Type;
// Required method
fn read<R: Read>(
&self,
message_type: u16,
buffer: &mut R,
) -> Result<Option<Self::CustomMessage>, DecodeError>;
}Expand description
Trait to be implemented by custom message (unrelated to the channel/gossip LN layers) decoders.
Required Associated Types§
sourcetype CustomMessage: Type
type CustomMessage: Type
The type of the message decoded by the implementation.
Required Methods§
sourcefn read<R: Read>(
&self,
message_type: u16,
buffer: &mut R,
) -> Result<Option<Self::CustomMessage>, DecodeError>
fn read<R: Read>( &self, message_type: u16, buffer: &mut R, ) -> Result<Option<Self::CustomMessage>, DecodeError>
Decodes a custom message to CustomMessageType. If the given message type is known to the
implementation and the message could be decoded, must return Ok(Some(message)). If the
message type is unknown to the implementation, must return Ok(None). If a decoding error
occur, must return Err(DecodeError::X) where X details the encountered error.
Object Safety§
This trait is not object safe.