Skip to content

Commit

Permalink
remove TryFrom<u64> for Id and it's inverse
Browse files Browse the repository at this point in the history
  • Loading branch information
vnprc committed Nov 13, 2024
1 parent 8791109 commit 67fc241
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions crates/cdk/src/nuts/nut02.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,24 +126,6 @@ impl TryFrom<Id> for u32 {
}
}

impl TryFrom<u64> for Id {
type Error = Error;
fn try_from(value: u64) -> Result<Self, Self::Error> {
let bytes = value.to_be_bytes();
Self::from_bytes(&bytes)
}
}

impl TryFrom<Id> for u64 {
type Error = Error;

fn try_from(value: Id) -> Result<Self, Self::Error> {
let bytes = value.to_bytes();
let byte_array: [u8; 8] = bytes.try_into().map_err(|_| Error::Length)?;
Ok(u64::from_be_bytes(byte_array))
}
}

impl fmt::Display for Id {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&format!("{}{}", self.version, hex::encode(self.id)))
Expand Down

0 comments on commit 67fc241

Please sign in to comment.