pub struct Client<E, T: Backend<E>> { /* private fields */ }
Expand description
Async CoAP client, generic over Backend implementations
Implementations§
Source§impl Client<Error, Tokio>
impl Client<Error, Tokio>
Sourcepub async fn connect<H>(host: H, opts: &ClientOptions) -> Result<Self, Error>
pub async fn connect<H>(host: H, opts: &ClientOptions) -> Result<Self, Error>
Create a new client with the provided host and client options
Source§impl<E, T> Client<E, T>
impl<E, T> Client<E, T>
Sourcepub async fn request(
&mut self,
method: Method,
resource: &str,
data: Option<&[u8]>,
opts: &RequestOptions,
) -> Result<Packet, Error<E>>
pub async fn request( &mut self, method: Method, resource: &str, data: Option<&[u8]>, opts: &RequestOptions, ) -> Result<Packet, Error<E>>
Perform a basic CoAP request
Sourcepub async fn observe(
&mut self,
resource: &str,
opts: &RequestOptions,
) -> Result<<T as Backend<E>>::Observe, E>
pub async fn observe( &mut self, resource: &str, opts: &RequestOptions, ) -> Result<<T as Backend<E>>::Observe, E>
Observe the provided resource
Sourcepub async fn unobserve(
&mut self,
o: <T as Backend<E>>::Observe,
) -> Result<(), E>
pub async fn unobserve( &mut self, o: <T as Backend<E>>::Observe, ) -> Result<(), E>
Deregister an observation
Sourcepub async fn get(
&mut self,
resource: &str,
opts: &RequestOptions,
) -> Result<Vec<u8>, Error<E>>
pub async fn get( &mut self, resource: &str, opts: &RequestOptions, ) -> Result<Vec<u8>, Error<E>>
Perform a Get request from the provided resource
Trait Implementations§
Auto Trait Implementations§
impl<E, T> Freeze for Client<E, T>where
T: Freeze,
impl<E, T> RefUnwindSafe for Client<E, T>where
T: RefUnwindSafe,
E: RefUnwindSafe,
impl<E, T> Sync for Client<E, T>
impl<E, T> Unpin for Client<E, T>
impl<E, T> UnwindSafe for Client<E, T>where
T: UnwindSafe,
E: UnwindSafe,
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