pub struct Rand;Expand description
Zero-size type with static methods wrapping RAND_bytes / RAND_priv_bytes.
Implementations§
Source§impl Rand
impl Rand
Sourcepub fn fill_private(buf: &mut [u8]) -> Result<(), ErrorStack>
pub fn fill_private(buf: &mut [u8]) -> Result<(), ErrorStack>
Sourcepub fn bytes(n: usize) -> Result<Vec<u8>, ErrorStack>
pub fn bytes(n: usize) -> Result<Vec<u8>, ErrorStack>
Allocate and fill a Vec<u8> of n random bytes.
Prefer fill when the destination buffer is already allocated.
§Errors
Sourcepub fn bytes_private(n: usize) -> Result<Vec<u8>, ErrorStack>
pub fn bytes_private(n: usize) -> Result<Vec<u8>, ErrorStack>
Allocate and fill a Vec<u8> of n private random bytes.
Equivalent to bytes but uses RAND_priv_bytes — suitable for key
material and other values that must not be disclosed.
§Errors
Auto Trait Implementations§
impl Freeze for Rand
impl RefUnwindSafe for Rand
impl Send for Rand
impl Sync for Rand
impl Unpin for Rand
impl UnsafeUnpin for Rand
impl UnwindSafe for Rand
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