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>
impl<Endpoint: Display + PartialEq + Clone> Subject<Endpoint>
sourcepub fn register(&mut self, request: &CoapRequest<Endpoint>)
pub fn register(&mut self, request: &CoapRequest<Endpoint>)
Registers an observer interested in a resource.
sourcepub fn deregister(&mut self, request: &CoapRequest<Endpoint>)
pub fn deregister(&mut self, request: &CoapRequest<Endpoint>)
Removes an observer from the interested resource.
sourcepub fn resource_changed(&mut self, resource: &str, message_id: u16)
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.
sourcepub fn acknowledge(&mut self, request: &CoapRequest<Endpoint>)
pub fn acknowledge(&mut self, request: &CoapRequest<Endpoint>)
Resets the counter of unacknowledged updates for a resource observer.
sourcepub fn get_resource(&self, resource: &str) -> Option<&Resource<Endpoint>>
pub fn get_resource(&self, resource: &str) -> Option<&Resource<Endpoint>>
Gets the tracked resources.
sourcepub fn get_resource_observers(
&self,
resource: &str
) -> Option<Vec<&Observer<Endpoint>>>
pub fn get_resource_observers( &self, resource: &str ) -> Option<Vec<&Observer<Endpoint>>>
Gets the observers of a resource.
sourcepub fn set_unacknowledged_limit(&mut self, limit: u8)
pub fn set_unacknowledged_limit(&mut self, limit: u8)
Sets the limit of unacknowledged updates before removing an observer.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more