Struct bip_peer::PeerProtocolCodec
[−]
[src]
pub struct PeerProtocolCodec<P> { /* fields omitted */ }
Codec operating over some PeerProtocol
.
Methods
impl<P> PeerProtocolCodec<P>
[src]
fn new(protocol: P) -> PeerProtocolCodec<P>
Create a new PeerProtocolCodec
.
It is strongly recommended to use PeerProtocolCodec::with_max_payload
instead of this function, as this function will not enforce a limit on
received payload length.
fn with_max_payload(protocol: P, max_payload: usize) -> PeerProtocolCodec<P>
Create a new PeerProtocolCodec
which will yield an error if
receiving a payload larger than the specified max_payload
.
Trait Implementations
impl<P> Decoder for PeerProtocolCodec<P> where
P: PeerProtocol,
[src]
P: PeerProtocol,
type Item = P::ProtocolMessage
The type of decoded frames.
type Error = Error
The type of unrecoverable frame decoding errors. Read more
fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Self::Item>>
Attempts to decode a frame from the provided buffer of bytes. Read more
fn decode_eof(
&mut self,
buf: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
&mut self,
buf: &mut BytesMut
) -> Result<Option<Self::Item>, Self::Error>
A default method available to be called when there are no more bytes available to be read from the underlying I/O. Read more
impl<P> Encoder for PeerProtocolCodec<P> where
P: PeerProtocol,
[src]
P: PeerProtocol,