Implement AsRef<[u8]> for Script

This commit is contained in:
Steven Roose 2021-02-10 14:26:57 +01:00
parent 6a0f68df85
commit 96fa4b7d9b
No known key found for this signature in database
GPG Key ID: 2F2A88D7F8D68E87
1 changed files with 6 additions and 0 deletions

View File

@ -43,6 +43,12 @@ use util::key::PublicKey;
/// A Bitcoin script
pub struct Script(Box<[u8]>);
impl AsRef<[u8]> for Script {
fn as_ref(&self) -> &[u8] {
&self.0
}
}
impl fmt::Debug for Script {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("Script(")?;