pub struct CoAPShared<const CONCURRENT_REQUESTS: usize> { /* private fields */ }
Expand description
The shared state of a CoAP main loop, which would typically run as a server and client simultaneously.
This is usually created once and then [.split()
] up into a client and a server part.
Relevant generics:
CONCURRENT_REQUESTS
indicates how many requests may be outstanding simultaneously on the client side. Note that this distinct fromNSTART
in two ways:NSTART
is counted per peer (this is total), and is decremented as soon as the request is ACK’ed (this is until the (final) response has been processed).
Implementations§
pub fn new() -> Self
Sourcepub fn split<'a>(
&'a self,
) -> (CoAPRuntimeClient<'a, CONCURRENT_REQUESTS>, CoAPRunner<'a, CONCURRENT_REQUESTS>)
pub fn split<'a>( &'a self, ) -> (CoAPRuntimeClient<'a, CONCURRENT_REQUESTS>, CoAPRunner<'a, CONCURRENT_REQUESTS>)
Split a CoAPShared into a client and a server/runner part.
While technically both of them are just thin wrappers around a shared reference, this split ensures that the otherwise-panicking constraints about who grabs which mutices when are upheld.
Auto Trait Implementations§
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