#[repr(transparent)]pub struct Index(u32);Expand description
A tagged block index (MSB = chain status, lower 31 bits = position in the header file).
- If MSB = 0, the block is in the main chain. In this case, the index is equal to the block height, as we store mainchain headers with canonical order.
- If MSB = 1, the block is in a fork chain. In this case, the index is different from the height, as we store fork headers (in the fork file) in the order they are found.
Tuple Fields§
§0: u32Implementations§
Source§impl Index
impl Index
Sourceconst INDEX_MASK: u32 = 2_147_483_647u32
const INDEX_MASK: u32 = 2_147_483_647u32
Mask for the 31 lower bits
Sourcepub fn new(index: u32) -> Result<Self, FlatChainstoreError>
pub fn new(index: u32) -> Result<Self, FlatChainstoreError>
Create a new mainchain entry (MSB is zero)
Sourcepub fn new_fork(index: u32) -> Result<Self, FlatChainstoreError>
pub fn new_fork(index: u32) -> Result<Self, FlatChainstoreError>
Create a new fork entry (MSB is set)
Sourcepub fn is_main_chain(&self) -> bool
pub fn is_main_chain(&self) -> bool
Tells if this is a block in our main chain
Trait Implementations§
Source§impl Ord for Index
impl Ord for Index
Source§impl PartialOrd for Index
impl PartialOrd for Index
impl Copy for Index
impl Eq for Index
impl StructuralPartialEq for Index
Auto Trait Implementations§
impl Freeze for Index
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnwindSafe for Index
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.