//! This module provides basic functions to seed the libcoap PRNG and retrieve random bytes from it.
//! [rand] crate that allow using the libcoap PRNG as a [rand::Rng] or setting the libcoap PRNG to
/// Will return an error if libcoap's PRNG has an error or the underlying mutex was poisoned by a
static COAP_RNG_FN_MUTEX: Mutex<Option<Box<dyn ErrorErasingTryRngCore + Send + Sync>>> = Mutex::new(None);
// Should be reconsidered either if libcoap removes this fallback or if we can detect whether the
/// Configures libcoap to use the provided `rng` for pseudo-random number generation instead of its
/// lead to a stack overflow, as [CoapRng] would recursively call into itself to generate random
pub fn set_coap_prng<RNG: TryRngCore + CryptoRng + Send + Sync + 'static>(rng: RNG) -> Result<(), RngError> {
/// This function is intended as a [libcoap_sys::coap_rand_func_t], therefore `out` should be valid