pub struct NetconfCodec { /* private fields */ }Implementations§
Source§impl NetconfCodec
tokio_util codec for NETCONF message framing.
impl NetconfCodec
tokio_util codec for NETCONF message framing.
Implements the Decoder trait from tokio_util. Instead of returning
complete messages, the decoder yields DecodedFrame items:
individual Chunks as data arrives, followed by EndOfMessage when
the message boundary is reached.
This chunk-level output enables the reader task to route messages
without buffering: normal RPCs accumulate chunks into a BytesMut,
while streaming RPCs forward each chunk directly to the consumer.
The Encoder side is unchanged — it frames complete XML documents
with the appropriate delimiter/chunking.
pub fn new(framing_mode: FramingMode, config: CodecConfig) -> Self
pub fn set_mode(&mut self, framing_mode: FramingMode)
pub fn framing_mode(&self) -> FramingMode
Sourcepub fn set_closing(&mut self)
pub fn set_closing(&mut self)
Mark the codec as closing so that decode_eof silently discards
leftover holdback bytes instead of treating them as an error.
Trait Implementations§
Source§impl Decoder for NetconfCodec
impl Decoder for NetconfCodec
Source§fn decode_eof(
&mut self,
buf: &mut BytesMut,
) -> Result<Option<Self::Item>, Self::Error>
fn decode_eof( &mut self, buf: &mut BytesMut, ) -> Result<Option<Self::Item>, Self::Error>
Handle EOF from the underlying transport.
When closing is set (a close-session RPC is in flight), leftover
holdback bytes are harmless artifacts of the EOM split-marker guard
and are silently discarded. Otherwise we fall back to the default
behaviour: any remaining bytes at EOF indicate a transport problem.