pub struct Blockchain { /* private fields */ }Implementations§
Source§impl Blockchain
impl Blockchain
pub fn new(reward: u64, halving: u64) -> Blockchain
pub fn calculate_reward(&self, block_number: u64) -> u64
pub fn add_block(&mut self, data: String) -> Result<(), &'static str>
pub fn validate_chain(&self, path: String) -> bool
pub fn load_chain_from_disk( file_path: String, get_reward: u64, get_halving_interval: u64, ) -> Result<Blockchain, &'static str>
Trait Implementations§
Source§impl Debug for Blockchain
impl Debug for Blockchain
Source§impl<'de> Deserialize<'de> for Blockchain
impl<'de> Deserialize<'de> for Blockchain
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Blockchain
impl RefUnwindSafe for Blockchain
impl Send for Blockchain
impl Sync for Blockchain
impl Unpin for Blockchain
impl UnwindSafe for Blockchain
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