embedded_cal_rustcrypto/standalone.rs
1// SPDX-License-Identifier: MIT OR Apache-2.0
2// SPDX-FileCopyrightText: Inria-AIO, Cryspen, and Christian Amsüss
3
4use embedded_cal::empty;
5
6use super::*;
7
8/// Type alias for the output of [`Standalone::standalone()`]
9pub type Standalone = RustcryptoCalExtender<embedded_cal_rand::WithSysRng<empty::EmptyCal>>;
10
11impl Standalone {
12 /// Creates a software-only cal, whose RNG functionality is backed by the system as chosen by
13 /// [`rand::make_rng()`](https://docs.rs/rand/latest/rand/fn.make_rng.html).
14 pub fn standalone() -> Self {
15 Self::new_extending(embedded_cal_rand::WithSysRng::new_from_sys(empty::EmptyCal))
16 }
17}
18
19impl Default for Standalone {
20 fn default() -> Self {
21 Self::standalone()
22 }
23}