Skip to content

Commit

Permalink
TryFrom SliceData
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyVavilin committed Feb 4, 2025
1 parent 40662c0 commit 4e2948d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tvm_types/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ impl From<Vec<u8>> for UInt256 {
}
}

impl TryFrom<SliceData> for UInt256 {
type Error = Error;

fn try_from(mut value: SliceData) -> Result<Self> {
let mut result = Self::default();
value.get_next_bytes_to_slice(result.0.as_mut())?;
Ok(result)
}
}

impl FromStr for UInt256 {
type Err = Error;

Expand Down

0 comments on commit 4e2948d

Please sign in to comment.