Struct embedded_nal_minimal_coaptcpserver::ConnectionState[][src]

pub struct ConnectionState<ST: TcpClientStack + TcpExactStack + ?Sized, const CONFIGURED_BUFLEN: usize> { /* fields omitted */ }
Expand description

Internals necessarily carried around per connection.

The type (ST) and CONFIGURED_BUFLEN do not conceptionally need to be tied to the state (even though it makes no sense to apply one state to different stacks or even different sockets at different pollings). It is still carried around to have a buffer length available for stack allocation use, even while ST::RECVBUFLEN is not usable that way.

CONFIGURED_BUFLEN should, on the long run, take its default from ST::SENDBUFLEN and ST::RECVBUFLEN, but that appears to be impossible in Rust at the moment, and implementations may want to use smaller buffers anyway. A reasonable default would be 1152 (the default Maximum-Message-Size, which peers might send without waiting for the CSM).

Implementations

Attempt to process any pending messages out of the given socket on a UDP stack.

Any CoAP requests are dispatched to the handler. A response is built immediately and sent.

Temporary failure to read from any action immediately makes the function return WouldBlock, and it should be called again whenever there is indication that the network device is ready again; same goes for the initial writing of a CSM message that is mandatory in CoAP over TCP.

Any failure to write at response time, as well as protocol errors, are fatal and propagate out as errors. In that case, the socket gets closed, and the function must not be called on this socket again.

There is no successful return; whenever all pending requests have been processed, WouldBlock indicates that the function has done all it can do right now.

Note that the caveats in the module description apply.

Like [poll_connection], but rather than allocating a buffer on the stack (which needs zeroing out), using a provided scratch memory.

In situations where stack space is scarce, this can also take a global scratch space, which is shared with other tasks that don’t run concurrently.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.