Skip to main content

Event

Enum Event 

Source
pub enum Event<'a> {
    Settings(SettingsFrame<'a>),
    SettingsAck(Settings),
    Headers {
        stream: u32,
        headers: Vec<Header>,
        end_stream: bool,
        kind: HeadersKind,
    },
    Data {
        stream: u32,
        bytes: &'a [u8],
        end_stream: bool,
    },
    PushPromise {
        stream: u32,
        promised: u32,
        headers: Vec<Header>,
    },
    Reset {
        stream: u32,
        code: u32,
    },
    Unprocessed {
        stream: u32,
    },
    Goaway {
        last_stream: u32,
        code: u32,
        debug: Option<&'a [u8]>,
    },
    Ping {
        ack: bool,
        data: [u8; 8],
    },
    WindowUpdate {
        stream: u32,
    },
}

Variants§

§

Settings(SettingsFrame<'a>)

The peer’s SETTINGS, already applied and acknowledged.

§

SettingsAck(Settings)

The peer acknowledged the oldest SETTINGS frame this endpoint still had outstanding; its parameters are returned here and are now in force. Acknowledgements arrive in the order the frames were sent (RFC 9113 section 6.5.3), and the first is always for the frame the constructor queued, so a host that timestamps construction and each Connection::settings call can pair them in FIFO order to measure a round trip. No clock is read here.

§

Headers

Fields

§stream: u32
§headers: Vec<Header>
§end_stream: bool
§

Data

Fields

§stream: u32
§bytes: &'a [u8]
§end_stream: bool
§

PushPromise

The server promised a response to the request headers (RFC 9113 section 8.4), on stream, a stream this endpoint opened. promised is the server-initiated stream that will carry the response: its HEADERS and DATA arrive as ordinary events, and Connection::reset declines it. Only a client receives this, and only while it has not disabled push with ENABLE_PUSH = 0.

Fields

§stream: u32
§promised: u32
§headers: Vec<Header>
§

Reset

The stream is over. It may name a stream the host never saw opened: a stream past the concurrent-stream limit is refused with RST_STREAM(REFUSED_STREAM) before any Event::Headers for it is produced (RFC 9113 section 5.1.2 requires a stream error there, and Node answers the same way — measured).

Fields

§stream: u32
§code: u32
§

Unprocessed

The peer opened a stream after a graceful GOAWAY, above the last stream id that GOAWAY named, and nothing has been sent for it. RFC 9113 section 6.8 makes such a stream simply “not processed” — the peer is expected to retry it on a new connection — and Node emits no frame at all here (measured against Node 26.5.1 with a raw peer: no RST_STREAM, no GOAWAY, the session stays alive and the request never reaches the application).

The header block was decoded and discarded, because HPACK is connection state. The connection deliberately does not answer for the host: a frame it emitted could not be un-emitted, so a host that must match Node would have no way back. A host that wants to answer may call Connection::reset.

Fields

§stream: u32
§

Goaway

Fields

§last_stream: u32
§code: u32
§debug: Option<&'a [u8]>

The opaque debug data (RFC 9113 section 6.8). None when the frame carried none - Node reports undefined there, not an empty buffer. The wire cannot express “present but empty”, so this is never Some of an empty slice.

§

Ping

Fields

§ack: bool
§data: [u8; 8]
§

WindowUpdate

Fields

§stream: u32

Trait Implementations§

Source§

impl<'a> Debug for Event<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Forget for Event<'a>

§

impl<'a> Freeze for Event<'a>

§

impl<'a> RefUnwindSafe for Event<'a>

§

impl<'a> Send for Event<'a>

§

impl<'a> Sync for Event<'a>

§

impl<'a> Unpin for Event<'a>

§

impl<'a> UnsafeUnpin for Event<'a>

§

impl<'a> UnwindSafe for Event<'a>

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.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.