[][src]Struct plasma_cash_token::Token

pub struct Token<TxnType, HashType> where
    TxnType: PlasmaCashTxn<HashType>,
    HashType: AsRef<[u8]>, 
{ pub uid: BitVec, pub status: TokenStatus, pub history: Vec<TxnType>, pub proofs: Vec<Vec<HashType>>, }

Token storage type that performs history verification and challenge detection for a given token.

Can be serialized for wire transmission and data storage purposes.

Example

Users of this API should should define this e.g.

This example is not tested
let t: Token<Transaction, H256> = Token::new(uid); // `uid` is BitVec

Fields

uid: BitVecstatus: TokenStatushistory: Vec<TxnType>proofs: Vec<Vec<HashType>>

Methods

impl<'a, TxnType, HashType> Token<TxnType, HashType> where
    TxnType: PlasmaCashTxn<HashType>,
    HashType: AsRef<[u8]>, 
[src]

pub fn new(uid: BitVec) -> Token<TxnType, HashType>[src]

Create new token with given uid stored on the rootchain. (history is empty to start)

pub fn is_valid(&self) -> bool[src]

Validate history of token is consistent

pub fn add_transaction(&mut self, txn: TxnType) -> Result<(), &'static str>[src]

Add a new transaction to the history. Must first pass validation that new transaction follows old one.

Auto Trait Implementations

impl<TxnType, HashType> Sync for Token<TxnType, HashType> where
    HashType: Sync,
    TxnType: Sync

impl<TxnType, HashType> Send for Token<TxnType, HashType> where
    HashType: Send,
    TxnType: Send

impl<TxnType, HashType> Unpin for Token<TxnType, HashType> where
    HashType: Unpin,
    TxnType: Unpin

impl<TxnType, HashType> UnwindSafe for Token<TxnType, HashType> where
    HashType: UnwindSafe,
    TxnType: UnwindSafe

impl<TxnType, HashType> RefUnwindSafe for Token<TxnType, HashType> where
    HashType: RefUnwindSafe,
    TxnType: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]