Struct luk_chain::BlockChain [−][src]
pub struct BlockChain<T> {
pub chain: Vec<Block<T>>,
pub users: HashMap<u128, RsaPublicKey>,
pub created_at: Duration,
// some fields omitted
}Expand description
Struct to define local copy of blockchain
Fields
chain: Vec<Block<T>>Contains all Block instances in chain
users: HashMap<u128, RsaPublicKey>All known participants in network
created_at: DurationTime since Epoch that BlockChain was created
Implementations
Adds a new Block to the [Blockchain]
[id] is the ID of the user who is in charge of the local instance of the
BlockChain
Goes through the [Blockchain] and validates it
Goes through the BlockChain and checks if Event
is already in BlockChain
Adds a new user to BlockChain
Length of underlying BlockChain
Calculates the percentage similarity with compared BlockChain
Sets the location to write the BlockChain to
Returns the location of the BlockChain in the filesystem
Writes the current state of the BlockChain to its specified file
Trait Implementations
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
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
Auto Trait Implementations
impl<T> RefUnwindSafe for BlockChain<T> where
T: RefUnwindSafe,
impl<T> Send for BlockChain<T> where
T: Send,
impl<T> Sync for BlockChain<T> where
T: Sync,
impl<T> Unpin for BlockChain<T> where
T: Unpin,
impl<T> UnwindSafe for BlockChain<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
fn from_stream<'life0, 'life1, 'async_trait, R: AsyncReadExt + Send + Unpin>(
stream: &'life0 mut R,
buffer: &'life1 mut [u8]
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>> where
R: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
fn from_stream<'life0, 'life1, 'async_trait, R: AsyncReadExt + Send + Unpin>(
stream: &'life0 mut R,
buffer: &'life1 mut [u8]
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>> where
R: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
Reads a [Message] from a raw stream of bytes, dealing with length prefixing.
type Output = T
type Output = T
Should always be Self