Struct celestia_types::sample::SampleId

source ·
pub struct SampleId { /* private fields */ }
Expand description

Identifies a particular Share located in the ExtendedDataSquare.

Implementations§

source§

impl SampleId

source

pub fn new(row_index: u16, column_index: u16, block_height: u64) -> Result<Self>

Create a new SampleId for the given row_index and column_index of the ExtendedDataSquare in a block.

§Errors

This function will return an error if the block height is zero.

§Example
use celestia_types::sample::SampleId;

// Consider an 64 share EDS with block height of 15
let header_height = 15;

SampleId::new(2, 1, header_height).unwrap();
source

pub fn block_height(&self) -> u64

A height of the block which contains the sample.

source

pub fn row_index(&self) -> u16

Row index of the ExtendedDataSquare that sample is located on.

source

pub fn column_index(&self) -> u16

Column index of the ExtendedDataSquare that sample is located on.

Trait Implementations§

source§

impl Clone for SampleId

source§

fn clone(&self) -> SampleId

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 SampleId

source§

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

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

impl From<SampleId> for CidGeneric<SAMPLE_ID_SIZE>

source§

fn from(sample_id: SampleId) -> Self

Converts to this type from the input type.
source§

impl PartialEq for SampleId

source§

fn eq(&self, other: &SampleId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<const S: usize> TryFrom<Cid<S>> for SampleId

§

type Error = CidError

The type returned in the event of a conversion error.
source§

fn try_from(cid: CidGeneric<S>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Copy for SampleId

source§

impl StructuralPartialEq for SampleId

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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 for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<S> CondSend for S
where S: Send,

source§

impl<S> CondSync for S
where S: Send + Sync,