Struct libblockchain::block::Block
[−]
[src]
pub struct Block<T: Hash> { pub id: u64, pub value: T, pub previous_id: u64, pub timestamp: DateTime<Utc>, }
A Block
representation.
Fields
id: u64
An height identifier of the given Block
.
value: T
A binding of the given Block
.
previous_id: u64
An identifier of the previous Block
in the Chain
.
timestamp: DateTime<Utc>
A timespec that the given Block
was created.
Methods
impl<T: Hash> Block<T>
[src]
fn new(id: u64, value: T, previous_id: u64) -> Block<T>
[src]
Creates a new Block
.
fn is_trusty_for(&self, other: &Block<T>) -> bool
[src]
Returns true
if the given Block
is trusty for the next Block
.
Examples
use libblockchain::Block; let block0 = Block::new(0, vec![0; 256], 0); let block1 = block0.next(vec![1, 2]); assert!(block1.is_trusty_for(&block0))
fn next(&self, value: T) -> Block<T>
[src]
Constructs the next Block
.
Examples
use libblockchain::Block; let block0 = Block::new(0, vec![0; 256], 0); let block1 = block0.next(vec![1, 2]); println!("{:?}", block1)
Trait Implementations
impl<T: Clone + Hash> Clone for Block<T>
[src]
fn clone(&self) -> Block<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Debug + Hash> Debug for Block<T>
[src]
impl<T: Hash + Hash> Hash for Block<T>
[src]
fn hash<__HT: Hasher>(&self, __arg_0: &mut __HT)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more