feat: add Identifier::random and some other tiny fixes
This commit is contained in:
parent
f462630eb4
commit
405cf8b368
8 changed files with 190 additions and 11 deletions
|
|
@ -1,10 +1,17 @@
|
|||
use std::fmt::{Display, Formatter, LowerHex};
|
||||
use rand::random;
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
|
||||
pub struct Identifier {
|
||||
pub bytes: [u8; 4],
|
||||
}
|
||||
|
||||
impl Identifier {
|
||||
pub fn random() -> Identifier {
|
||||
Identifier::from(random::<u32>())
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Identifier {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue