Struct coap::client::CoAPClient
source · pub struct CoAPClient { /* private fields */ }
Implementations
sourceimpl CoAPClient
impl CoAPClient
sourcepub fn new_with_specific_source<A: ToSocketAddrs, B: ToSocketAddrs>(
bind_addr: A,
peer_addr: B
) -> Result<CoAPClient>
pub fn new_with_specific_source<A: ToSocketAddrs, B: ToSocketAddrs>(
bind_addr: A,
peer_addr: B
) -> Result<CoAPClient>
Create a CoAP client with the specific source and peer address.
sourcepub fn new<A: ToSocketAddrs>(addr: A) -> Result<CoAPClient>
pub fn new<A: ToSocketAddrs>(addr: A) -> Result<CoAPClient>
Create a CoAP client with the peer address.
sourcepub fn get(url: &str) -> Result<CoAPResponse>
pub fn get(url: &str) -> Result<CoAPResponse>
Execute a get request
sourcepub fn get_with_timeout(url: &str, timeout: Duration) -> Result<CoAPResponse>
pub fn get_with_timeout(url: &str, timeout: Duration) -> Result<CoAPResponse>
Execute a get request with the coap url and a specific timeout.
sourcepub fn observe<H: FnMut(Packet) + Send + 'static>(
&mut self,
resource_path: &str,
handler: H
) -> Result<()>
pub fn observe<H: FnMut(Packet) + Send + 'static>(
&mut self,
resource_path: &str,
handler: H
) -> Result<()>
Observe a resource with the handler
sourcepub fn request_with_timeout(
url: &str,
timeout: Option<Duration>
) -> Result<CoAPResponse>
👎Deprecated since 0.6.0: please use get_with_timeout
instead
pub fn request_with_timeout(
url: &str,
timeout: Option<Duration>
) -> Result<CoAPResponse>
get_with_timeout
insteadExecute a request with the coap url and a specific timeout. Default timeout is 5s.
sourcepub fn request(url: &str) -> Result<CoAPResponse>
👎Deprecated since 0.6.0: please use get
instead
pub fn request(url: &str) -> Result<CoAPResponse>
get
insteadExecute a request with the coap url.
sourcepub fn send(&self, request: &CoAPRequest) -> Result<()>
pub fn send(&self, request: &CoAPRequest) -> Result<()>
Execute a request.
sourcepub fn receive(&self) -> Result<CoAPResponse>
pub fn receive(&self) -> Result<CoAPResponse>
Receive a response.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for CoAPClient
impl Send for CoAPClient
impl !Sync for CoAPClient
impl Unpin for CoAPClient
impl !UnwindSafe for CoAPClient
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more