Type Alias delegation::pallet::DelegationNodeOf
source · pub type DelegationNodeOf<T> = DelegationNode<DelegationNodeIdOf<T>, <T as Config>::MaxChildren, DelegationDetails<DelegatorIdOf<T>>, <T as Config>::AccountId, <<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance>;
Aliased Type§
struct DelegationNodeOf<T> {
pub hierarchy_root_id: <T as Config>::DelegationNodeId,
pub parent: Option<<T as Config>::DelegationNodeId>,
pub children: BoundedBTreeSet<<T as Config>::DelegationNodeId, <T as Config>::MaxChildren>,
pub details: DelegationDetails<<T as Config>::DelegationEntityId>,
pub deposit: Deposit<<T as Config>::AccountId, <<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance>,
}
Fields§
§hierarchy_root_id: <T as Config>::DelegationNodeId
The ID of the delegation hierarchy the node is part of.
parent: Option<<T as Config>::DelegationNodeId>
The ID of the parent. For all but root nodes this is not None.
children: BoundedBTreeSet<<T as Config>::DelegationNodeId, <T as Config>::MaxChildren>
The set of IDs of all the children nodes.
details: DelegationDetails<<T as Config>::DelegationEntityId>
The additional information attached to the delegation node.
deposit: Deposit<<T as Config>::AccountId, <<T as Config>::Currency as Inspect<<T as Config>::AccountId>>::Balance>
The deposit that was taken to incentivise fair use of the on chain storage.
Implementations§
source§impl<DelegationNodeId: Ord, MaxChildren: Get<u32>, DelegationDetails, AccountId, Balance> DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>
impl<DelegationNodeId: Ord, MaxChildren: Get<u32>, DelegationDetails, AccountId, Balance> DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>
sourcepub fn new_root_node(
id: DelegationNodeId,
details: DelegationDetails,
deposit_owner: AccountId,
deposit_amount: Balance
) -> Self
pub fn new_root_node( id: DelegationNodeId, details: DelegationDetails, deposit_owner: AccountId, deposit_amount: Balance ) -> Self
Creates a new delegation root node with the given ID and delegation details.
sourcepub fn new_node(
hierarchy_root_id: DelegationNodeId,
parent: DelegationNodeId,
details: DelegationDetails,
deposit_owner: AccountId,
deposit_amount: Balance
) -> Self
pub fn new_node( hierarchy_root_id: DelegationNodeId, parent: DelegationNodeId, details: DelegationDetails, deposit_owner: AccountId, deposit_amount: Balance ) -> Self
Creates a new delegation node under the given hierarchy ID, with the given parent and delegation details.
sourcepub fn try_add_child(
&mut self,
child_id: DelegationNodeId
) -> Result<(), DelegationNodeId>
pub fn try_add_child( &mut self, child_id: DelegationNodeId ) -> Result<(), DelegationNodeId>
Adds a node by its ID to the current node’s children.
Trait Implementations§
source§impl<DelegationNodeId: Clone, MaxChildren: Clone + Get<u32>, DelegationDetails: Clone, AccountId: Clone, Balance: Clone> Clone for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>
impl<DelegationNodeId: Clone, MaxChildren: Clone + Get<u32>, DelegationDetails: Clone, AccountId: Clone, Balance: Clone> Clone for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>
source§fn clone(
&self
) -> DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>
fn clone( &self ) -> DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<DelegationNodeId: Debug, MaxChildren: Debug + Get<u32>, DelegationDetails: Debug, AccountId: Debug, Balance: Debug> Debug for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>
impl<DelegationNodeId: Debug, MaxChildren: Debug + Get<u32>, DelegationDetails: Debug, AccountId: Debug, Balance: Debug> Debug for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>
source§impl<DelegationNodeId, MaxChildren: Get<u32>, DelegationDetails, AccountId, Balance> Decode for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>where
DelegationNodeId: Decode,
Option<DelegationNodeId>: Decode,
BoundedBTreeSet<DelegationNodeId, MaxChildren>: Decode,
DelegationDetails: Decode,
Deposit<AccountId, Balance>: Decode,
impl<DelegationNodeId, MaxChildren: Get<u32>, DelegationDetails, AccountId, Balance> Decode for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>where DelegationNodeId: Decode, Option<DelegationNodeId>: Decode, BoundedBTreeSet<DelegationNodeId, MaxChildren>: Decode, DelegationDetails: Decode, Deposit<AccountId, Balance>: Decode,
source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy ) -> Result<Self, Error>
Attempt to deserialise the value from input.
§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self> ) -> Result<DecodeFinished, Error>where I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where I: Input,
Attempt to skip the encoded value from input. Read more
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
source§impl<DelegationNodeId, MaxChildren: Get<u32>, DelegationDetails, AccountId, Balance> Encode for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>where
DelegationNodeId: Encode,
Option<DelegationNodeId>: Encode,
BoundedBTreeSet<DelegationNodeId, MaxChildren>: Encode,
DelegationDetails: Encode,
Deposit<AccountId, Balance>: Encode,
impl<DelegationNodeId, MaxChildren: Get<u32>, DelegationDetails, AccountId, Balance> Encode for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>where DelegationNodeId: Encode, Option<DelegationNodeId>: Encode, BoundedBTreeSet<DelegationNodeId, MaxChildren>: Encode, DelegationDetails: Encode, Deposit<AccountId, Balance>: Encode,
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )
Convert self to a slice and append it to the destination.
§fn using_encoded<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> Rwhere F: FnOnce(&[u8]) -> R,
Convert self to a slice and then invoke the given closure with it.
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
source§impl<DelegationNodeId, MaxChildren: Get<u32>, DelegationDetails, AccountId, Balance> MaxEncodedLen for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>where
DelegationNodeId: MaxEncodedLen,
Option<DelegationNodeId>: MaxEncodedLen,
BoundedBTreeSet<DelegationNodeId, MaxChildren>: MaxEncodedLen,
DelegationDetails: MaxEncodedLen,
Deposit<AccountId, Balance>: MaxEncodedLen,
impl<DelegationNodeId, MaxChildren: Get<u32>, DelegationDetails, AccountId, Balance> MaxEncodedLen for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>where DelegationNodeId: MaxEncodedLen, Option<DelegationNodeId>: MaxEncodedLen, BoundedBTreeSet<DelegationNodeId, MaxChildren>: MaxEncodedLen, DelegationDetails: MaxEncodedLen, Deposit<AccountId, Balance>: MaxEncodedLen,
source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Upper bound, in bytes, of the maximum encoded size of this item.
source§impl<DelegationNodeId: PartialEq, MaxChildren: PartialEq + Get<u32>, DelegationDetails: PartialEq, AccountId: PartialEq, Balance: PartialEq> PartialEq<DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>> for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>
impl<DelegationNodeId: PartialEq, MaxChildren: PartialEq + Get<u32>, DelegationDetails: PartialEq, AccountId: PartialEq, Balance: PartialEq> PartialEq<DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>> for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>
source§fn eq(
&self,
other: &DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>
) -> bool
fn eq( &self, other: &DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance> ) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.