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>

source

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.

source

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.

source

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>

source§

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)

Performs copy-assignment from source. Read more
source§

impl<DelegationNodeId: Debug, MaxChildren: Debug + Get<u32>, DelegationDetails: Debug, AccountId: Debug, Balance: Debug> Debug for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
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,

source§

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,

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,

Attempt to skip the encoded value from input. Read more
§

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,

source§

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 )

Convert self to a slice and append it to the destination.
§

fn encode(&self) -> Vec<u8, Global>

Convert self to an owned vector.
§

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

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,

source§

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>

source§

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 ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance> TypeInfo for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>where DelegationNodeId: TypeInfo + 'static, Option<DelegationNodeId>: TypeInfo + 'static, BoundedBTreeSet<DelegationNodeId, MaxChildren>: TypeInfo + 'static, DelegationDetails: TypeInfo + 'static, Deposit<AccountId, Balance>: TypeInfo + 'static, MaxChildren: Get<u32> + TypeInfo + 'static, AccountId: TypeInfo + 'static, Balance: TypeInfo + 'static,

§

type Identity = DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>

The type identifying for which type info is provided. Read more
source§

fn type_info() -> Type

Returns the static type identifier for Self.
source§

impl<DelegationNodeId, MaxChildren: Get<u32>, DelegationDetails, AccountId, Balance> EncodeLike<DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>> for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>where DelegationNodeId: Encode, Option<DelegationNodeId>: Encode, BoundedBTreeSet<DelegationNodeId, MaxChildren>: Encode, DelegationDetails: Encode, Deposit<AccountId, Balance>: Encode,

source§

impl<DelegationNodeId: Eq, MaxChildren: Eq + Get<u32>, DelegationDetails: Eq, AccountId: Eq, Balance: Eq> Eq for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>

source§

impl<DelegationNodeId, MaxChildren: Get<u32>, DelegationDetails, AccountId, Balance> StructuralEq for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>

source§

impl<DelegationNodeId, MaxChildren: Get<u32>, DelegationDetails, AccountId, Balance> StructuralPartialEq for DelegationNode<DelegationNodeId, MaxChildren, DelegationDetails, AccountId, Balance>