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_masterchain(&self) -> bool
pub const fn is_masterchain(&self) -> bool
Returns true if this shard is a masterchain shard.
See MASTERCHAIN
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 opposite(&self) -> Option<Self>
pub const fn opposite(&self) -> Option<Self>
Returns the opposite shard if appliable.
Returns None for the shard with depth == 0.
Sourcepub const fn prefix_len(&self) -> u16
pub const fn prefix_len(&self) -> u16
Returns shard prefix len in bits.
Sourcepub const fn can_split(&self) -> bool
pub const fn can_split(&self) -> bool
Returns whether the shard depth is in the possible range.
Sourcepub fn contains_address<T: Addr>(&self, address: &T) -> bool
pub fn contains_address<T: Addr>(&self, address: &T) -> bool
Returns true if the specified address could be stored in the current shard.
Sourcepub const fn contains_account(&self, account: &HashBytes) -> bool
pub const fn contains_account(&self, account: &HashBytes) -> 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§const fn clone_from(&mut self, source: &Self)
const 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<'de> Deserialize<'de> for ShardIdent
impl<'de> Deserialize<'de> for ShardIdent
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for ShardIdent
impl Display for ShardIdent
Source§impl From<ShardIdent> for ShardIdentFull
impl From<ShardIdent> for ShardIdentFull
Source§fn from(ident: ShardIdent) -> Self
fn from(ident: ShardIdent) -> Self
Source§impl FromStr for ShardIdent
impl FromStr for ShardIdent
Source§impl Hash for ShardIdent
impl Hash for ShardIdent
Source§impl<'a> Load<'a> for ShardIdent
impl<'a> Load<'a> 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 for ShardIdent
impl PartialEq for ShardIdent
Source§impl PartialOrd for ShardIdent
impl PartialOrd for ShardIdent
Source§impl Serialize for ShardIdent
impl Serialize for ShardIdent
Source§impl Store for ShardIdent
impl Store for ShardIdent
Source§fn store_into(
&self,
builder: &mut CellBuilder,
_: &dyn CellContext,
) -> Result<(), Error>
fn store_into( &self, builder: &mut CellBuilder, _: &dyn CellContext, ) -> Result<(), Error>
Source§impl TryFrom<ShardIdentFull> for ShardIdent
impl TryFrom<ShardIdentFull> for ShardIdent
impl Copy for ShardIdent
impl Eq for ShardIdent
impl StructuralPartialEq for ShardIdent
Auto Trait Implementations§
impl Freeze for ShardIdent
impl RefUnwindSafe for ShardIdent
impl Send for ShardIdent
impl Sync for ShardIdent
impl Unpin for ShardIdent
impl UnwindSafe for ShardIdent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
self to key and returns true if they are equal.