Reverse a clone of [u8; 32] instead of allocating
This commit is contained in:
parent
4289843852
commit
b856d23069
|
@ -11,7 +11,7 @@ pub struct BlockHash(pub [u8; 32]);
|
||||||
|
|
||||||
impl fmt::Display for BlockHash {
|
impl fmt::Display for BlockHash {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let mut data = self.0.to_vec();
|
let mut data = self.0.clone();
|
||||||
data.reverse();
|
data.reverse();
|
||||||
formatter.write_str(&hex::encode(data))
|
formatter.write_str(&hex::encode(data))
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ pub struct TxId(pub [u8; 32]);
|
||||||
|
|
||||||
impl fmt::Display for TxId {
|
impl fmt::Display for TxId {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let mut data = self.0.to_vec();
|
let mut data = self.0.clone();
|
||||||
data.reverse();
|
data.reverse();
|
||||||
formatter.write_str(&hex::encode(data))
|
formatter.write_str(&hex::encode(data))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue