Trait breez_sdk_core::lightning::ln::wire::CustomMessageReader
pub trait CustomMessageReader {
type CustomMessage: Type;
// Required method
fn read<R>(
&self,
message_type: u16,
buffer: &mut R,
) -> Result<Option<Self::CustomMessage>, DecodeError>
where R: Read;
}
Expand description
Trait to be implemented by custom message (unrelated to the channel/gossip LN layers) decoders.
Required Associated Types§
type CustomMessage: Type
type CustomMessage: Type
The type of the message decoded by the implementation.
Required Methods§
fn read<R>(
&self,
message_type: u16,
buffer: &mut R,
) -> Result<Option<Self::CustomMessage>, DecodeError>where
R: Read,
fn read<R>(
&self,
message_type: u16,
buffer: &mut R,
) -> Result<Option<Self::CustomMessage>, DecodeError>where
R: Read,
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.