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

An height identifier of the given Block.

A binding of the given Block.

An identifier of the previous Block in the Chain.

A timespec that the given Block was created.

Methods

impl<T: Hash> Block<T>
[src]

[src]

Creates a new Block.

[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))

[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]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: Debug + Hash> Debug for Block<T>
[src]

[src]

Formats the value using the given formatter.

impl<T: Hash + Hash> Hash for Block<T>
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<T: PartialEq + Hash> PartialEq for Block<T>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.