Skip to main content

Event

Enum Event 

Source
#[non_exhaustive]
pub enum Event { HandshakeFailed { reason: AssociationError, }, Connected, Restarted, AssociationLost { reason: AssociationError, id: StreamId, }, AssociationClosed { reason: AssociationError, }, PathInactive, PathActive, CommunicationError { causes: Vec<(ErrorCauseCode, Bytes)>, }, SendFailure { unsent: usize, unacknowledged: usize, }, Stream(StreamEvent), DatagramReceived, Reconfig(ReconfigEvent), }
Expand description

Events of interest to the application

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

HandshakeFailed

Handshake was failed

Fields

§reason: AssociationError

Reason that the association was closed

§

Connected

The association was successfully established

§

Restarted

The peer restarted the association (RFC 9260 5.2.4 action A): it sent an INIT and then a COOKIE ECHO with the Tie-Tags of this association, as an endpoint that lost its state does. The association is a new one from here on, with new tags and TSNs, no streams and congestion control from its initial values; what was queued or in flight on the old one is gone. Reported instead of Event::AssociationLost (5.2.4: “a RESTART notification”).

§

AssociationLost

The association was lost

Emitted if the peer closes the association or an error is encountered.

Fields

§reason: AssociationError

Reason that the association was closed

§id: StreamId

The stream the loss was reported against.

§

AssociationClosed

The association closed, after an AssociationLost for each of its streams. Emitted whether or not it had streams, so an application that keeps state beside the association (a pre-negotiated data channel that never carried data) learns of it.

Fields

§reason: AssociationError

Reason that the association was closed

§

PathInactive

The path to the peer is inactive: Path.Max.Retrans consecutive retransmissions or HEARTBEATs went unanswered (RFC 9260 sections 8.2, 8.3). The association goes on trying, up to TimerConfig::max_t3_rtx_retrans.

§

PathActive

The path to the peer answers again after Event::PathInactive.

§

CommunicationError

The peer sent an ERROR chunk (RFC 9260 11.2.5 COMMUNICATION ERROR): each cause’s code and its cause-specific information as received (RFC 9260 3.3.10).

Fields

§causes: Vec<(ErrorCauseCode, Bytes)>

The causes, in the order the chunk carried them.

§

SendFailure

The association ended with user messages it did not deliver (RFC 9260 11.2.2 SEND FAILURE, 8.1): read them with Association::take_undelivered_messages. Reported before Event::AssociationClosed. A message of a partially reliable stream given up while the association ran is reported with StreamEvent::MessageAbandoned instead.

Fields

§unsent: usize

Messages no part of which was sent.

§unacknowledged: usize

Messages sent, at least in part, and not completely acknowledged.

§

Stream(StreamEvent)

Stream events

§

DatagramReceived

One or more application datagrams have been received

§

Reconfig(ReconfigEvent)

The outcome of a stream re-configuration (RFC 6525): a request of this side’s own was answered, or the peer changed the association.

Trait Implementations§

Source§

impl Debug for Event

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Event

§

impl Freeze for Event

§

impl Move for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event
where RawVecInner: Send, Bytes: Send,

§

impl Sync for Event
where RawVecInner: Sync, Bytes: Sync,

§

impl Unpin for Event
where *const u8 is !null: Unpin, *const u8: Unpin, Align8<*mut ()>: Unpin, &'static Vtable: Unpin,

§

impl UnsafeUnpin for Event

§

impl UnwindSafe for Event
where RawVecInner: UnwindSafe, *const u8: UnwindSafe, Align8<*mut ()>: UnwindSafe, &'static Vtable: UnwindSafe,

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.