Skip to content

Commit

Permalink
Add as_slice to Checksum
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed Nov 16, 2023
1 parent 43c024c commit 389c3e9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/std/src/checksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ impl Checksum {
pub fn to_hex(self) -> String {
self.to_string()
}

/// Returns a reference to the inner bytes of this checksum as a slice.
/// If you need a reference to the array, use [`AsRef::as_ref`].
pub fn as_slice(&self) -> &[u8] {
&self.0
}

Check warning on line 43 in packages/std/src/checksum.rs

View check run for this annotation

Codecov / codecov/patch

packages/std/src/checksum.rs#L41-L43

Added lines #L41 - L43 were not covered by tests
}

impl fmt::Display for Checksum {
Expand Down

0 comments on commit 389c3e9

Please sign in to comment.