pub struct CoapPublisher { /* private fields */ }Expand description
A handle that sets the state of a server’s resources from anywhere, while
another task waits on the server’s recv.
A gateway that takes readings in one loop and sends commands from another holds one of these for the commands, since a receive holds the server itself.
Implementations§
Source§impl CoapPublisher
impl CoapPublisher
Sourcepub async fn publish(&self, path: &str, payload: &[u8]) -> Result<()>
pub async fn publish(&self, path: &str, payload: &[u8]) -> Result<()>
Sets the state of a resource and notifies every observer of it.
§Arguments
path- the resource’s path.payload- its new state, which a GET now reads.
§Returns
Ok(()) once each observer’s notification has left. An observer that has
gone does not stop the others’ notifications.
§Errors
Returns [Error::Closed] if the server is not connected, or
[Error::Transport] if the socket failed for a reason other than an observer
that has gone.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Sourcepub fn local_addr(&self) -> Option<SocketAddr>
pub fn local_addr(&self) -> Option<SocketAddr>
The address the server listens on.
§Returns
The local address, or None while the server is not connected.
Trait Implementations§
Source§impl Clone for CoapPublisher
impl Clone for CoapPublisher
Source§fn clone(&self) -> CoapPublisher
fn clone(&self) -> CoapPublisher
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CoapPublisher
impl RefUnwindSafe for CoapPublisher
impl Send for CoapPublisher
impl Sync for CoapPublisher
impl Unpin for CoapPublisher
impl UnsafeUnpin for CoapPublisher
impl UnwindSafe for CoapPublisher
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