remove new alloc on deserialization (#15636)

This commit is contained in:
Jeff Washington (jwash)
2021-03-23 14:52:59 -05:00
committed by GitHub
parent e7fd7d46cf
commit 6f5d8d18e9
2 changed files with 10 additions and 1 deletions

View File

@ -325,6 +325,12 @@ impl AsRef<[u8]> for Pubkey {
}
}
impl AsMut<[u8]> for Pubkey {
fn as_mut(&mut self) -> &mut [u8] {
&mut self.0[..]
}
}
impl fmt::Debug for Pubkey {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", bs58::encode(self.0).into_string())