pub struct Block<T: Hash> {
pub id: u64,
pub value: T,
pub previous_id: u64,
pub timestamp: DateTime<Utc>,
}
Expand description
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.
Implementations§
Source§impl<T: Hash> Block<T>
impl<T: Hash> Block<T>
Sourcepub fn is_trusty_for(&self, other: &Block<T>) -> bool
pub fn is_trusty_for(&self, other: &Block<T>) -> bool
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))
Trait Implementations§
impl<T: Hash> StructuralPartialEq for Block<T>
Auto Trait Implementations§
impl<T> Freeze for Block<T>where
T: Freeze,
impl<T> RefUnwindSafe for Block<T>where
T: RefUnwindSafe,
impl<T> Send for Block<T>where
T: Send,
impl<T> Sync for Block<T>where
T: Sync,
impl<T> Unpin for Block<T>where
T: Unpin,
impl<T> UnwindSafe for Block<T>where
T: UnwindSafe,
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