IncomingEvent

Enum IncomingEvent 

Source
pub enum IncomingEvent<'a> {
    Nothing,
    Request(bool, EncodedMessage<'a>),
    DuplicatedRequest,
    SendAck,
    SendCon,
    Success,
    SendRst,
    Timeout,
    RecvRst,
}
Expand description

What has happened in the IncomingCommunication path when calling CoapEndpoint::process

This type is annotated with must_use because some events require user interaction to avoid getting stuck in specific states. See the documentation for the specific events for more information.

Variants§

§

Nothing

No real event happened. This pseudo-event is included as a variant here to allow concise event handling on the user side.

§

Request(bool, EncodedMessage<'a>)

A new request was received. The user must respond to this event. The event contains the bool flag if the request is confirmable (true) or non-confirmable (false) and the request message itself.

In any case, the response may be sent with IncomingCommunication::schedule_response immediately. For CON requests, this will result in a piggybacked response. For NON requests, a NON response will be sent. For other options, see the IncomingState::Received state.

The contained EncodedMessage keeps the borrow of the Endpoint alive which might be undesirable in some situations. To resolve this, it may safely be dropped, it can be accessed later via IncomingCommunication::request.

§

DuplicatedRequest

We have received the same request again. Depending on how we have already handled the request, appropriate action is taken automatically. For example, if the request has already been ACKed but a separate response is still missing, we send the ACK again. If we have sent a NON response before which may not have reached the other endpoint, we send it again.

§

SendAck

We have sent an ACK. With this event, a state transition into IncomingState::AwaitingResponse takes place in which more user interaction is required.

§

SendCon

A separate CON response has been (re-)sent. NON and piggybacked responses directly result in a IncomingEvent::Success event.

§

Success

We have successfully finished the communication (from our perspective). If our response was piggybacked or a separate NON message, we have no guarantee that the other endpoint has already received our response. If our response was a separate CON message, the corresponding ACK has been received and we know that the other endpoint has received our response.

§

SendRst

We have sent a RST message. With this event, a state transition into IncomingState::Idle takes place.

§

Timeout

Sending the separate CON response has timed out. Piggybacked or separate NON responses will not be ACKed so they can not time out.

§

RecvRst

We have received a RST when sending a separate CON response

Trait Implementations§

Source§

impl<'a> Clone for IncomingEvent<'a>

Source§

fn clone(&self) -> IncomingEvent<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for IncomingEvent<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> PartialEq for IncomingEvent<'a>

Source§

fn eq(&self, other: &IncomingEvent<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Eq for IncomingEvent<'a>

Source§

impl<'a> StructuralPartialEq for IncomingEvent<'a>

Auto Trait Implementations§

§

impl<'a> !Freeze for IncomingEvent<'a>

§

impl<'a> !RefUnwindSafe for IncomingEvent<'a>

§

impl<'a> Send for IncomingEvent<'a>

§

impl<'a> !Sync for IncomingEvent<'a>

§

impl<'a> Unpin for IncomingEvent<'a>

§

impl<'a> UnwindSafe for IncomingEvent<'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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.