pub fn write<const N: usize>(
closure: impl FnOnce(&mut WriteMessage<'_>),
) -> Vec<u8, N>Expand description
Dress up a writable buffer of a constant size as a writable CoAP message
§Open issues
Can we do any better than sending the user through a closure? It’s not like we have to do any actual cleanup, we just^TM need to create the inmemory_write::Message with a reference, and be there when it is destructed.
In an even advanced version, this might take an in-place writer to place the bytes into, rather than moving a heapless::Vec around (and hoping for return value optimization).