#[non_exhaustive]pub struct ControlFrame<'a> {
pub draft: DraftVersion,
pub outbound: bool,
pub message: &'a AnyControlMessage,
pub raw: Option<&'a [u8]>,
}Expand description
One control message as it crossed the wire, lifted out of whichever draft’s event carried it.
AnyClientEvent wraps a draft’s own ClientEvent, so an observer holding
one can read draft and nothing else without
matching every enabled variant — which means a consumer outside this crate
writing its own cascade over every draft, the exact duplication this module
exists to hold in one place. AnyClientEvent::control_frame answers with
this instead.
Everything here borrows from the event, so it is a view rather than a record: a consumer that wants to keep a frame copies the bytes out.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.draft: DraftVersionThe draft whose rules were used to decode it.
outbound: boolWhether this endpoint sent it, as opposed to receiving it.
A bool rather than a shared direction enum because each draft declares
its own Direction and there is no cross-draft one to lift them into;
inventing a sixteenth to convert the other fifteen into would be a type
whose only purpose is to be converted.
message: &'a AnyControlMessageThe decoded message. message_type_id and message_type_name name
the codepoint it arrived under.
raw: Option<&'a [u8]>The framed wire bytes — type, length and payload — as they arrived.
None when the connection was reading without an observer attached and
therefore never cloned them. That cannot happen for an event an observer
is being handed, so in practice this is None only for a frame built by
hand.
Kept because the encoding is evidence the decoding discards: two peers sending the same field can still disagree on how wide a varint they wrote it in, and the decoded form answers the same either way.