Skip to main content

ControlStreamParser

Struct ControlStreamParser 

Source
pub struct ControlStreamParser {
    buf: BytesMut,
    draft: DraftVersion,
    capture_raw: bool,
}
Expand description

Stateful inline parser for a MoQT control stream.

Accepts raw byte chunks (as they arrive from RecvStream::read), buffers them, and emits complete ParsedFrames. In the default (non-capturing) mode the parser does not clone the frame bytes; in capturing mode it does, so a hook can rewrite the frame before the proxy forwards it.

Fields§

§buf: BytesMut§draft: DraftVersion§capture_raw: bool

Implementations§

Source§

impl ControlStreamParser

Source

pub fn new(draft: DraftVersion) -> Self

Create a new observation-only parser.

ParsedFrame::raw_bytes will be None; use Self::new_capturing when a hook needs to mutate frames.

Source

pub fn new_capturing(draft: DraftVersion) -> Self

Create a new parser that captures the raw wire bytes of each frame.

Use this variant only when a hook may rewrite frames; the extra Bytes::copy_from_slice per frame is unnecessary for pure pass-through forwarding.

Source

pub fn feed(&mut self, data: &[u8]) -> ParseResult

Feed raw bytes into the parser.

Returns ParseResult::Messages if one or more complete frames could be decoded, or ParseResult::NeedMore if more data is needed. Partial frames are buffered internally.

Source

pub fn draft(&self) -> DraftVersion

Returns the draft version this parser is configured for.

Trait Implementations§

Source§

impl Default for ControlStreamParser

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more