pub struct ShardIdent { /* private fields */ }
Expand description

Shard ident.

Implementations§

source§

impl ShardIdent

source

pub const PREFIX_FULL: u64 = 9_223_372_036_854_775_808u64

The prefix for the full shard.

source

pub const MAX_SPLIT_DEPTH: u8 = 60u8

Max possible shard split depth.

source

pub const BITS: u16 = 104u16

The number of data bits that this struct occupies.

source

pub const MASTERCHAIN: Self = _

Masterchain shard ident.

source

pub const BASECHAIN: Self = _

Base workchain shard ident.

source

pub const fn new(workchain: i32, prefix: u64) -> Option<Self>

Tries to create a new shard ident from parts.

source

pub const fn new_full(workchain: i32) -> Self

Creates a new full shard ident for the specified workchain.

source

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).
source

pub const fn workchain(&self) -> i32

Returns the shard workchain.

source

pub const fn prefix(&self) -> u64

Returns the shard prefix.

source

pub const fn is_full(&self) -> bool

Returns true if this shard could not be merged further.

See PREFIX_FULL

source

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.

source

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.

source

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.

source

pub const fn is_parent_of(&self, child: &Self) -> bool

Returns true if the current shard is the direct parent of the specified shard.

source

pub const fn is_child_of(&self, parent: &Self) -> bool

Returns true if the current shard is the direct child of the specified shard.

source

pub const fn intersects(&self, other: &Self) -> bool

Returns true if one shard fully includes another.

source

pub const fn merge(&self) -> Option<Self>

Returns the parent shard of the current shard.

Returns None for the full shard.

source

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.

source

pub const fn prefix_len(&self) -> u16

Returns shard prefix len in bits.

source

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

source§

fn clone(&self) -> ShardIdent

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 Debug for ShardIdent

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for ShardIdent

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Display for ShardIdent

source§

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

Formats the value using the given formatter. Read more
source§

impl Hash for ShardIdent

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a, C: CellFamily> Load<'a, C> for ShardIdent

source§

fn load_from(slice: &mut CellSlice<'a, C>) -> Option<Self>

Tries to load itself from a cell slice.
source§

impl Ord for ShardIdent

source§

fn cmp(&self, other: &ShardIdent) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<ShardIdent> for ShardIdent

source§

fn eq(&self, other: &ShardIdent) -> 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 PartialOrd<ShardIdent> for ShardIdent

source§

fn partial_cmp(&self, other: &ShardIdent) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<C: CellFamily> Store<C> for ShardIdent

source§

fn store_into( &self, builder: &mut CellBuilder<C>, _: &mut dyn Finalizer<C> ) -> bool

Tries to store itself into the cell builder.
source§

impl Copy for ShardIdent

source§

impl Eq for ShardIdent

source§

impl StructuralEq for ShardIdent

source§

impl StructuralPartialEq for ShardIdent

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.