[−][src]Struct damn_vuln_blockchain::block::Block
Smallest data-sctructure that can go into Chain.
NOTE: tx
, prev
, validator and rx
are Option<_>
to accomodate
genesis block. Blockchain implementors must check for the
existence of genesis block before appending the block to
the ledger
Implementations
impl Block
[src]
pub fn to_string(&self) -> String
[src]
Get block info as string
pub fn genesis() -> Block
[src]
creates genesis block
pub fn is_genesis(&self) -> bool
[src]
checks if the block is a genesis block
pub fn hash(&self) -> String
[src]
computes the hash of a block, uses the same logic for genesis blocks, it simply returns the hash stored in the block as genesis() computes hash over random strings
pub fn get_prev(&self) -> Option<&String>
[src]
get hash of previous block
pub fn get_asset_id(&self) -> Option<&String>
[src]
get hash of previous block
pub fn get_hash(&self) -> &str
[src]
get hash of block
pub fn get_serial_no(&self) -> Option<usize>
[src]
get serial numbr of block
pub fn set_serial_no(&mut self, serial_no: usize)
[src]
set serial_no of block
pub fn get_rx(&self) -> Option<&String>
[src]
get receiver involved in the transaction that lead tot the creation of this block
pub fn get_validator(&self) -> Option<&String>
[src]
get validator involved in the creation of this block
pub fn get_tx(&self) -> Option<&String>
[src]
get sender involved in the transaction that lead tot the creation of this block
Trait Implementations
impl Clone for Block
[src]
impl Debug for Block
[src]
impl Default for Block
[src]
impl<'de> Deserialize<'de> for Block
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for Block
[src]
impl Serialize for Block
[src]
Auto Trait Implementations
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnwindSafe for Block
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,