Struct coap_lite::Subject

source ·
pub struct Subject<Endpoint: Display + PartialEq> { /* private fields */ }
Expand description

Keeps track of the state of the observed resources.

Implementations§

source§

impl<Endpoint: Display + PartialEq + Clone> Subject<Endpoint>

source

pub fn register(&mut self, request: &CoapRequest<Endpoint>)

Registers an observer interested in a resource.

source

pub fn deregister(&mut self, request: &CoapRequest<Endpoint>)

Removes an observer from the interested resource.

source

pub fn resource_changed(&mut self, resource: &str, message_id: u16)

Updates the resource information after having notified the observers.

It increments the resource sequence and counter of unacknowledged updates.

source

pub fn acknowledge(&mut self, request: &CoapRequest<Endpoint>)

Resets the counter of unacknowledged updates for a resource observer.

source

pub fn get_resource(&self, resource: &str) -> Option<&Resource<Endpoint>>

Gets the tracked resources.

source

pub fn get_resource_observers( &self, resource: &str ) -> Option<Vec<&Observer<Endpoint>>>

Gets the observers of a resource.

source

pub fn set_unacknowledged_limit(&mut self, limit: u8)

Sets the limit of unacknowledged updates before removing an observer.

Trait Implementations§

source§

impl<Endpoint: Display + PartialEq + Clone> Default for Subject<Endpoint>

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<Endpoint> Freeze for Subject<Endpoint>

§

impl<Endpoint> RefUnwindSafe for Subject<Endpoint>
where Endpoint: RefUnwindSafe,

§

impl<Endpoint> Send for Subject<Endpoint>
where Endpoint: Send,

§

impl<Endpoint> Sync for Subject<Endpoint>
where Endpoint: Sync,

§

impl<Endpoint> Unpin for Subject<Endpoint>
where Endpoint: Unpin,

§

impl<Endpoint> UnwindSafe for Subject<Endpoint>
where Endpoint: UnwindSafe + RefUnwindSafe,

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>,

§

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>,

§

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.