Enum CoapSession

Source
pub enum CoapSession<'a> {
    Client(CoapClientSession<'a>),
    Server(CoapServerSession<'a>),
}
Expand description

The representation of a CoAP session.

This enum only provides functionality that is common between clients and servers (by implementing CoapSessionCommon). If you require functionality specific to client- or server-side sessions, match this enum on the required session type.

Variants§

Trait Implementations§

Source§

impl<'a> Debug for CoapSession<'a>

Source§

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

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

impl<'a> From<CoapClientSession<'a>> for CoapSession<'a>

Source§

fn from(session: CoapClientSession<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<CoapServerSession<'a>> for CoapSession<'a>

Source§

fn from(session: CoapServerSession<'a>) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for CoapSession<'_>

Source§

fn eq(&self, other: &Self) -> 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 Eq for CoapSession<'_>

Auto Trait Implementations§

§

impl<'a> Freeze for CoapSession<'a>

§

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

§

impl<'a> !Send for CoapSession<'a>

§

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

§

impl<'a> Unpin for CoapSession<'a>

§

impl<'a> !UnwindSafe for CoapSession<'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<'a, T> CoapSessionCommon<'a> for T
where T: CoapSessionCommonInternal<'a>,

Source§

fn app_data<T: Any>(&self) -> Result<Option<Rc<T>>, SessionGetAppDataError>

Returns the application specific data stored alongside this session.
Source§

fn set_app_data<T: 'static + Any>(&self, value: Option<T>)

Sets the application-specific data stored alongside this session.
Source§

fn clear_app_data(&self)

Clears the application-specific data stored alongside this session.
Source§

fn ack_random_factor(&self) -> (u16, u16)

Returns the Ack-Random-Factor used by libcoap. Read more
Source§

fn set_ack_random_factor(&self, integer_part: u16, fractional_part: u16)

Sets the Ack-Random-Factor used by libcoap.
Source§

fn ack_timeout(&self) -> (u16, u16)

Returns the current value of the Acknowledgement Timeout for this session (in seconds). Read more
Source§

fn set_ack_timeout(&self, integer_part: u16, fractional_part: u16)

Sets the value of the Acknowledgement Timeout for this session.
Source§

fn addr_local(&self) -> SocketAddr

Returns the local address for this session.
Source§

fn addr_remote(&self) -> SocketAddr

Returns the remote address for this session.
Source§

fn if_index(&self) -> IfIndex

Returns the interface index for this session.
Source§

fn max_retransmit(&self) -> MaxRetransmit

Returns the maximum number of retransmissions for this session.
Source§

fn set_max_retransmit(&mut self, value: MaxRetransmit)

Sets the maximum number of retransmissions for this session.
Source§

fn proto(&self) -> CoapProtocol

Returns the underlying transport protocol used for this session.
Source§

fn psk_hint(&self) -> Option<Box<[u8]>>

Returns the current PSK hint for this session.
Source§

fn psk_identity(&self) -> Option<Box<[u8]>>

Returns the current PSK identity for this session.
Source§

fn psk_key(&self) -> Option<Box<[u8]>>

Returns the current PSK key for this session.
Source§

fn state(&self) -> CoapSessionState

Returns the current state of this session.
Source§

fn init_token(&self, token: &[u8; 8])

Initializes the initial token value used by libcoap for this session. Read more
Source§

fn max_pdu_size(&self) -> usize

Returns the maximum size of a PDU for this session.
Source§

fn set_mtu(&self, mtu: u32)

Sets the maximum size of a PDU for this session.
Source§

fn next_message_id(&self) -> CoapMessageId

Returns the next message ID that should be used for this session.
Source§

fn new_token(&mut self, token: &mut [u8; 8]) -> usize

Returns the next token that should be used for requests.
Source§

fn send_ping(&mut self) -> CoapMessageId

Send a ping message to the remote peer.
Source§

fn send<P: Into<CoapMessage>>( &self, pdu: P, ) -> Result<CoapMessageId, MessageConversionError>

Send the given message-like object to the peer. Read more
Source§

fn send_request( &self, req: CoapRequest, ) -> Result<CoapRequestHandle, MessageConversionError>

Sends the given CoapRequest, returning a CoapRequestHandle that can be used to poll the request for completion. Read more
Source§

fn poll_handle(&self, handle: &CoapRequestHandle) -> IntoIter<CoapResponse>

Polls whether the request for the given handle already has pending responses. Read more
Source§

fn is_waiting_for_token(&self, token: &CoapToken) -> bool

Returns whether this session waits for the provided token.
Source§

fn remove_handle(&self, handle: CoapRequestHandle)

Stops listening for responses to this request handle. Read more
Source§

unsafe fn raw_session_mut(&self) -> *mut coap_session_t

Returns a mutable reference to the underlying raw session. Read more
Source§

unsafe fn raw_session(&self) -> *const coap_session_t

Returns a reference to the underlying raw session. 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 = 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T