pub struct RuntimeBlockchain { /* private fields */ }Expand description
Blockchain for runtime event logging
Implementations§
Source§impl RuntimeBlockchain
impl RuntimeBlockchain
pub fn new(difficulty: usize) -> Self
Sourcepub fn add_transaction(&self, tx_type: TransactionType, data: String)
pub fn add_transaction(&self, tx_type: TransactionType, data: String)
Add a transaction to pending pool
Sourcepub fn mine_block(&self) -> Block
pub fn mine_block(&self) -> Block
Mine a new block with pending transactions
Sourcepub fn stats(&self) -> BlockchainStats
pub fn stats(&self) -> BlockchainStats
Get blockchain statistics
Sourcepub fn recent_blocks(&self, count: usize) -> Vec<Block>
pub fn recent_blocks(&self, count: usize) -> Vec<Block>
Get recent blocks
Sourcepub fn search_transactions(&self, tx_type: &str) -> Vec<Transaction>
pub fn search_transactions(&self, tx_type: &str) -> Vec<Transaction>
Search transactions by type
Trait Implementations§
Source§impl Clone for RuntimeBlockchain
impl Clone for RuntimeBlockchain
Source§fn clone(&self) -> RuntimeBlockchain
fn clone(&self) -> RuntimeBlockchain
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RuntimeBlockchain
impl RefUnwindSafe for RuntimeBlockchain
impl Send for RuntimeBlockchain
impl Sync for RuntimeBlockchain
impl Unpin for RuntimeBlockchain
impl UnwindSafe for RuntimeBlockchain
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)