Struct everscale_types::models::block::ShardIdent
source · pub struct ShardIdent { /* private fields */ }Expand description
Shard ident.
Implementations§
source§impl ShardIdent
impl ShardIdent
sourcepub const PREFIX_FULL: u64 = 9_223_372_036_854_775_808u64
pub const PREFIX_FULL: u64 = 9_223_372_036_854_775_808u64
The prefix for the full shard.
sourcepub const MAX_SPLIT_DEPTH: u8 = 60u8
pub const MAX_SPLIT_DEPTH: u8 = 60u8
Max possible shard split depth.
sourcepub const MASTERCHAIN: Self = _
pub const MASTERCHAIN: Self = _
Masterchain shard ident.
sourcepub const fn new(workchain: i32, prefix: u64) -> Option<Self>
pub const fn new(workchain: i32, prefix: u64) -> Option<Self>
Tries to create a new shard ident from parts.
sourcepub const fn new_full(workchain: i32) -> Self
pub const fn new_full(workchain: i32) -> Self
Creates a new full shard ident for the specified workchain.
sourcepub const unsafe fn new_unchecked(workchain: i32, prefix: u64) -> Self
pub const unsafe fn new_unchecked(workchain: i32, prefix: u64) -> Self
Creates a new shard ident from parts.
Safety
The following must be true:
- prefix must not be zero.
- low bits must not be used (see
MAX_SPLIT_DEPTH).
sourcepub const fn is_full(&self) -> bool
pub const fn is_full(&self) -> bool
Returns true if this shard could not be merged further.
See PREFIX_FULL
sourcepub const fn is_left_child(&self) -> bool
pub const fn is_left_child(&self) -> bool
Returns true if this shard is the left child of the parent shard.
NOTE: Full shard is left.
sourcepub const fn is_right_child(&self) -> bool
pub const fn is_right_child(&self) -> bool
Returns true if this shard is the right child of the parent shard.
NOTE: Full shard is left.
sourcepub const fn is_ancestor_of(&self, shard: &Self) -> bool
pub const fn is_ancestor_of(&self, shard: &Self) -> bool
Returns true if the current shard is somewhere in the parents
hierarchy of the specified shard.
sourcepub const fn is_parent_of(&self, child: &Self) -> bool
pub const fn is_parent_of(&self, child: &Self) -> bool
Returns true if the current shard is the direct parent of the specified shard.
sourcepub const fn is_child_of(&self, parent: &Self) -> bool
pub const fn is_child_of(&self, parent: &Self) -> bool
Returns true if the current shard is the direct child of the specified shard.
sourcepub const fn intersects(&self, other: &Self) -> bool
pub const fn intersects(&self, other: &Self) -> bool
Returns true if one shard fully includes another.
sourcepub const fn merge(&self) -> Option<Self>
pub const fn merge(&self) -> Option<Self>
Returns the parent shard of the current shard.
Returns None for the full shard.
sourcepub const fn split(&self) -> Option<(Self, Self)>
pub const fn split(&self) -> Option<(Self, Self)>
Splits the current shard into two children.
Returns None for the shard with depth > MAX_SPLIT_DEPTH.
sourcepub const fn prefix_len(&self) -> u16
pub const fn prefix_len(&self) -> u16
Returns shard prefix len in bits.
sourcepub const fn contains_account(&self, account: &CellHash) -> bool
pub const fn contains_account(&self, account: &CellHash) -> bool
Returns true if the specified account could be stored in the current shard.
Trait Implementations§
source§impl Clone for ShardIdent
impl Clone for ShardIdent
source§fn clone(&self) -> ShardIdent
fn clone(&self) -> ShardIdent
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for ShardIdent
impl Debug for ShardIdent
source§impl Default for ShardIdent
impl Default for ShardIdent
source§impl Display for ShardIdent
impl Display for ShardIdent
source§impl Hash for ShardIdent
impl Hash for ShardIdent
source§impl<'a, C: CellFamily> Load<'a, C> for ShardIdent
impl<'a, C: CellFamily> Load<'a, C> for ShardIdent
source§impl Ord for ShardIdent
impl Ord for ShardIdent
source§fn cmp(&self, other: &ShardIdent) -> Ordering
fn cmp(&self, other: &ShardIdent) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<ShardIdent> for ShardIdent
impl PartialEq<ShardIdent> for ShardIdent
source§fn eq(&self, other: &ShardIdent) -> bool
fn eq(&self, other: &ShardIdent) -> bool
self and other values to be equal, and is used
by ==.source§impl PartialOrd<ShardIdent> for ShardIdent
impl PartialOrd<ShardIdent> for ShardIdent
source§fn partial_cmp(&self, other: &ShardIdent) -> Option<Ordering>
fn partial_cmp(&self, other: &ShardIdent) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more