pub struct FrameDecoder { /* private fields */ }Expand description
A low-level decoder that splits the byte stream into Frame values.
This decoder classifies each line purely from its content — it does
not track which command was sent. Multi-line response accumulation
(Line/End grouping) is left to higher layers.
>CLIENT:ENV accumulation is handled here because the protocol
guarantees atomicity for that block.
§Example
use bytes::BytesMut;
use tokio_util::codec::Decoder;
use openvpn_mgmt_frame::{Frame, FrameDecoder};
let mut decoder = FrameDecoder::new();
let mut buf = BytesMut::from(">INFO:OpenVPN Management Interface\n");
// The first >INFO: line is emitted as Frame::Info (the connection banner).
assert_eq!(
decoder.decode(&mut buf).unwrap(),
Some(Frame::Info("OpenVPN Management Interface".to_string())),
);Implementations§
Source§impl FrameDecoder
impl FrameDecoder
Sourcepub fn with_max_client_env_entries(self, limit: AccumulationLimit) -> Self
pub fn with_max_client_env_entries(self, limit: AccumulationLimit) -> Self
Set the maximum ENV entries for >CLIENT: notifications.
Trait Implementations§
Source§impl Debug for FrameDecoder
impl Debug for FrameDecoder
Source§impl Decoder for FrameDecoder
impl Decoder for FrameDecoder
Source§fn decode(
&mut self,
src: &mut BytesMut,
) -> Result<Option<Self::Item>, Self::Error>
fn decode( &mut self, src: &mut BytesMut, ) -> Result<Option<Self::Item>, Self::Error>
Attempts to decode a frame from the provided buffer of bytes. Read more
Auto Trait Implementations§
impl Freeze for FrameDecoder
impl RefUnwindSafe for FrameDecoder
impl Send for FrameDecoder
impl Sync for FrameDecoder
impl Unpin for FrameDecoder
impl UnsafeUnpin for FrameDecoder
impl UnwindSafe for FrameDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more