Struct solana_ledger::shred::Shred
source · [−]pub struct Shred {
pub common_header: ShredCommonHeader,
pub data_header: DataShredHeader,
pub coding_header: CodingShredHeader,
pub payload: Vec<u8>,
}
Fields
common_header: ShredCommonHeader
data_header: DataShredHeader
coding_header: CodingShredHeader
payload: Vec<u8>
Implementations
sourceimpl Shred
impl Shred
pub fn copy_to_packet(&self, packet: &mut Packet)
pub fn new_from_data(
slot: Slot,
index: u32,
parent_offset: u16,
data: Option<&[u8]>,
is_last_data: bool,
is_last_in_slot: bool,
reference_tick: u8,
version: u16,
fec_set_index: u32
) -> Self
pub fn new_from_serialized_shred(payload: Vec<u8>) -> Result<Self>
pub fn new_empty_coding(
slot: Slot,
index: u32,
fec_set_index: u32,
num_data: u16,
num_code: u16,
position: u16,
version: u16
) -> Self
pub fn new_empty_from_header(
common_header: ShredCommonHeader,
data_header: DataShredHeader,
coding_header: CodingShredHeader
) -> Self
pub fn new_empty_data_shred() -> Self
pub fn slot(&self) -> Slot
pub fn parent(&self) -> Result<Slot>
pub fn index(&self) -> u32
pub fn version(&self) -> u16
pub fn set_index(&mut self, index: u32)
pub fn set_slot(&mut self, slot: Slot)
pub fn signature(&self) -> Signature
pub fn seed(&self, leader_pubkey: Pubkey, root_bank: &Bank) -> [u8; 32]
pub fn shred_type(&self) -> ShredType
pub fn is_data(&self) -> bool
pub fn is_code(&self) -> bool
pub fn last_in_slot(&self) -> bool
sourcepub fn set_last_in_slot(&mut self)
pub fn set_last_in_slot(&mut self)
This is not a safe function. It only changes the meta information. Use this only for test code which doesn’t care about actual shred
pub fn data_complete(&self) -> bool
pub fn reference_tick(&self) -> u8
pub fn get_slot_from_packet(p: &Packet) -> Option<Slot>
pub fn reference_tick_from_data(data: &[u8]) -> u8
pub fn verify(&self, pubkey: &Pubkey) -> bool
Trait Implementations
impl StructuralPartialEq for Shred
Auto Trait Implementations
impl RefUnwindSafe for Shred
impl Send for Shred
impl Sync for Shred
impl Unpin for Shred
impl UnwindSafe for Shred
Blanket Implementations
sourceimpl<T> AbiExample for T
impl<T> AbiExample for T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> TupleTree<T, ()> for T
impl<T> TupleTree<T, ()> for T
const SIZE: Size
fn descendants(_indirect_level: usize) -> usize
fn height() -> usize
fn preorder(self, f: &mut impl FnMut(Visit<T>))
fn preorder_with_size_hint(self, f: &mut impl FnMut(Visit<T>, Size))
fn postorder(self, f: &mut impl FnMut(Visit<T>))
fn postorder_with_size_hint(self, f: &mut impl FnMut(Visit<T>, Size))
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more