Skip to content

Commit

Permalink
comments and derive
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Coats committed Sep 13, 2023
1 parent 7e89965 commit a95fab3
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions sdk/src/types/block/address/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ pub enum Address {
/// An Ed25519 address.
#[packable(tag = Ed25519Address::KIND)]
Ed25519(Ed25519Address),
/// An Ed25519 address.
/// A restricted Ed25519 address.
#[packable(tag = Restricted::<Ed25519Address>::KIND)]
RestrictedEd25519(Restricted<Ed25519Address>),
/// An account address.
#[packable(tag = AccountAddress::KIND)]
Account(AccountAddress),
/// An account address.
/// A restricted account address.
#[packable(tag = Restricted::<AccountAddress>::KIND)]
RestrictedAccount(Restricted<AccountAddress>),
/// An NFT address.
#[packable(tag = NftAddress::KIND)]
Nft(NftAddress),
/// An NFT address.
/// A restricted NFT address.
#[packable(tag = Restricted::<NftAddress>::KIND)]
RestrictedNft(Restricted<NftAddress>),
/// An NFT address.
/// An implicit account creation address.
#[packable(tag = ImplicitAccountCreationAddress::KIND)]
ImplicitAccountCreation(ImplicitAccountCreationAddress),
}
Expand Down Expand Up @@ -323,7 +323,7 @@ impl CapabilityFlag {
pub const ALL: u8 = u8::MAX;
}

#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash, From, Deref)]
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash, From, Deref, Packable)]
#[repr(transparent)]
pub struct Capabilities(u8);

Expand All @@ -348,22 +348,6 @@ impl Capabilities {
}
}

impl Packable for Capabilities {
type UnpackError = <u8 as Packable>::UnpackError;
type UnpackVisitor = ();

fn pack<P: packable::packer::Packer>(&self, packer: &mut P) -> Result<(), P::Error> {
self.0.pack(packer)
}

fn unpack<U: packable::unpacker::Unpacker, const VERIFY: bool>(
unpacker: &mut U,
_visitor: &Self::UnpackVisitor,
) -> Result<Self, packable::error::UnpackError<Self::UnpackError, U::Error>> {
u8::unpack::<_, VERIFY>(unpacker, &()).coerce().map(Into::into)
}
}

#[cfg(feature = "serde")]
pub(crate) mod dto {
use serde::{Deserialize, Serialize};
Expand Down

0 comments on commit a95fab3

Please sign in to comment.