Struct coap_client::Client
source · [−]pub struct Client<E, T: Backend<E>> { /* private fields */ }
Expand description
Async CoAP client, generic over Backend implementations
Implementations
sourceimpl Client<Error, Tokio>
impl Client<Error, Tokio>
sourcepub async fn connect<H>(host: H, opts: &ClientOptions) -> Result<Self, Error> where
H: TryInto<HostOptions>,
<H as TryInto<HostOptions>>::Error: Debug,
pub async fn connect<H>(host: H, opts: &ClientOptions) -> Result<Self, Error> where
H: TryInto<HostOptions>,
<H as TryInto<HostOptions>>::Error: Debug,
Create a new client with the provided host and client options
sourceimpl<E, T> Client<E, T> where
T: Backend<E>,
E: Debug,
impl<E, T> Client<E, T> where
T: Backend<E>,
E: Debug,
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> RefUnwindSafe for Client<E, T> where
E: RefUnwindSafe,
T: RefUnwindSafe,
impl<E, T> Sync for Client<E, T> where
E: Sync,
T: Sync,
impl<E, T> Unpin for Client<E, T> where
E: Unpin,
T: Unpin,
impl<E, T> UnwindSafe for Client<E, T> where
E: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more