Remove Script() from LowerHex impl of Script

This is easy for downstream to add, not easy for them to remove. Plus scripts
have a pretty recognizable form and are usually obvious from context anyway.
This commit is contained in:
Andrew Poelstra 2015-10-14 22:30:10 -05:00
parent 38d2ef5d73
commit fdc854edd9
2 changed files with 11 additions and 3 deletions

View File

@ -1,7 +1,7 @@
[package] [package]
name = "bitcoin" name = "bitcoin"
version = "0.3.4" version = "0.3.5"
authors = ["Andrew Poelstra <apoelstra@wpsoftware.net>"] authors = ["Andrew Poelstra <apoelstra@wpsoftware.net>"]
license = "CC0-1.0" license = "CC0-1.0"
homepage = "https://github.com/apoelstra/rust-bitcoin/" homepage = "https://github.com/apoelstra/rust-bitcoin/"

View File

@ -57,11 +57,19 @@ impl Clone for Script {
impl fmt::LowerHex for Script { impl fmt::LowerHex for Script {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(f.write_str("Script("));
for &ch in self.0.iter() { for &ch in self.0.iter() {
try!(write!(f, "{:02x}", ch)); try!(write!(f, "{:02x}", ch));
} }
f.write_str(")") Ok(())
}
}
impl fmt::UpperHex for Script {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for &ch in self.0.iter() {
try!(write!(f, "{:02X}", ch));
}
Ok(())
} }
} }