#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct DecryptableBalance(pub [u8; 36]);
#[cfg(feature = "serde")]
impl serde::Serialize for DecryptableBalance {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serde_big_array::BigArray::serialize(&self.0, serializer)
}
}
#[cfg(feature = "serde")]
impl<'de> serde::Deserialize<'de> for DecryptableBalance {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
serde_big_array::BigArray::deserialize(deserializer).map(DecryptableBalance)
}
}
impl From<[u8; 36]> for DecryptableBalance {
fn from(v: [u8; 36]) -> Self {
Self(v)
}
}
impl From<DecryptableBalance> for [u8; 36] {
fn from(v: DecryptableBalance) -> Self {
v.0
}
}
impl std::ops::Deref for DecryptableBalance {
type Target = [u8; 36];
fn deref(&self) -> &Self::Target {
&self.0
}
}