Derive Pod/Zeroable for Pubkey

This commit is contained in:
Michael Vines
2021-10-06 17:38:34 -07:00
parent df39b37cb8
commit f966859829
4 changed files with 23 additions and 16 deletions

View File

@@ -1,14 +1,16 @@
#![allow(clippy::integer_arithmetic)]
use crate::{decode_error::DecodeError, hash::hashv};
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
use num_derive::{FromPrimitive, ToPrimitive};
use std::{
convert::{Infallible, TryFrom},
fmt, mem,
str::FromStr,
use {
crate::{decode_error::DecodeError, hash::hashv},
borsh::{BorshDeserialize, BorshSchema, BorshSerialize},
bytemuck::{Pod, Zeroable},
num_derive::{FromPrimitive, ToPrimitive},
std::{
convert::{Infallible, TryFrom},
fmt, mem,
str::FromStr,
},
thiserror::Error,
};
use thiserror::Error;
/// Number of bytes in a pubkey
pub const PUBKEY_BYTES: usize = 32;
@@ -48,20 +50,22 @@ impl From<u64> for PubkeyError {
#[repr(transparent)]
#[derive(
Serialize,
Deserialize,
BorshSerialize,
AbiExample,
BorshDeserialize,
BorshSchema,
BorshSerialize,
Clone,
Copy,
Default,
Deserialize,
Eq,
PartialEq,
Ord,
PartialOrd,
Hash,
AbiExample,
Ord,
PartialEq,
PartialOrd,
Pod,
Serialize,
Zeroable,
)]
pub struct Pubkey([u8; 32]);