[−][src]Struct plasma_cash_token::Token
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: BitVec
status: TokenStatus
history: Vec<TxnType>
proofs: Vec<Vec<HashType>>
Methods
impl<'a, TxnType, HashType> Token<TxnType, HashType> where
TxnType: PlasmaCashTxn<HashType>,
HashType: AsRef<[u8]>,
[src]
TxnType: PlasmaCashTxn<HashType>,
HashType: AsRef<[u8]>,
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> Send for Token<TxnType, HashType> where
HashType: Send,
TxnType: Send,
HashType: Send,
TxnType: Send,
impl<TxnType, HashType> Unpin for Token<TxnType, HashType> where
HashType: Unpin,
TxnType: Unpin,
HashType: Unpin,
TxnType: Unpin,
impl<TxnType, HashType> Sync for Token<TxnType, HashType> where
HashType: Sync,
TxnType: Sync,
HashType: Sync,
TxnType: Sync,
impl<TxnType, HashType> UnwindSafe for Token<TxnType, HashType> where
HashType: UnwindSafe,
TxnType: UnwindSafe,
HashType: UnwindSafe,
TxnType: UnwindSafe,
impl<TxnType, HashType> RefUnwindSafe for Token<TxnType, HashType> where
HashType: RefUnwindSafe,
TxnType: RefUnwindSafe,
HashType: RefUnwindSafe,
TxnType: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,