feat: bugs and feats (ambiguous)

This commit is contained in:
Strix 2023-10-15 18:06:29 +02:00
parent d4a57edd95
commit 9865fd21ce
No known key found for this signature in database
GPG key ID: 49B2E37B8915B774
5 changed files with 53 additions and 77 deletions

View file

@ -12,6 +12,12 @@ impl Identifier {
}
}
impl Default for Identifier {
fn default() -> Self {
Identifier::from(0x00000000)
}
}
impl Display for Identifier {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(
@ -35,9 +41,9 @@ impl LowerHex for Identifier {
impl From<&[u8]> for Identifier {
fn from(value: &[u8]) -> Self {
let mut bytes = [0_u8; 4];
bytes[..value.len()].copy_from_slice(value);
bytes[..4].copy_from_slice(value[..4].as_ref());
Identifier {
bytes: [bytes[0], bytes[1], bytes[2], bytes[3]],
bytes
}
}
}