Struct chain_impl_mockchain::utxo::Ledger
source · pub struct Ledger<OutAddress>(Hamt<DefaultHasher, FragmentId, TransactionUnspents<OutAddress>>);
Expand description
Ledger of UTXO
Tuple Fields§
§0: Hamt<DefaultHasher, FragmentId, TransactionUnspents<OutAddress>>
Implementations§
source§impl<OutAddress: Clone> Ledger<OutAddress>
impl<OutAddress: Clone> Ledger<OutAddress>
sourcepub fn add(
&self,
tid: &FragmentId,
outs: &[(TransactionIndex, Output<OutAddress>)]
) -> Result<Self, Error>
pub fn add( &self, tid: &FragmentId, outs: &[(TransactionIndex, Output<OutAddress>)] ) -> Result<Self, Error>
Add new outputs associated with a specific transaction
Error if the transaction already exist
sourcepub fn remove(
&self,
tid: &FragmentId,
index: TransactionIndex
) -> Result<(Self, Output<OutAddress>), Error>
pub fn remove( &self, tid: &FragmentId, index: TransactionIndex ) -> Result<(Self, Output<OutAddress>), Error>
Spend a specific index from the transaction
pub fn remove_multiple( &self, tid: &FragmentId, indices: &[TransactionIndex] ) -> Result<(Self, Vec<Output<OutAddress>>), Error>
Trait Implementations§
source§impl<OutAddress: Clone> FromIterator<(Hash, Vec<(u8, Output<OutAddress>), Global>)> for Ledger<OutAddress>
impl<OutAddress: Clone> FromIterator<(Hash, Vec<(u8, Output<OutAddress>), Global>)> for Ledger<OutAddress>
source§fn from_iter<I: IntoIterator<Item = (FragmentId, Vec<(TransactionIndex, Output<OutAddress>)>)>>(
iter: I
) -> Self
fn from_iter<I: IntoIterator<Item = (FragmentId, Vec<(TransactionIndex, Output<OutAddress>)>)>>( iter: I ) -> Self
Creates a value from an iterator. Read more
source§impl<OutAddress: PartialEq> PartialEq<Ledger<OutAddress>> for Ledger<OutAddress>
impl<OutAddress: PartialEq> PartialEq<Ledger<OutAddress>> for Ledger<OutAddress>
impl<OutAddress: Eq> Eq for Ledger<OutAddress>
impl<OutAddress> StructuralEq for Ledger<OutAddress>
impl<OutAddress> StructuralPartialEq for Ledger<OutAddress>
Auto Trait Implementations§
impl<OutAddress> RefUnwindSafe for Ledger<OutAddress>where OutAddress: RefUnwindSafe,
impl<OutAddress> Send for Ledger<OutAddress>where OutAddress: Send + Sync,
impl<OutAddress> Sync for Ledger<OutAddress>where OutAddress: Send + Sync,
impl<OutAddress> Unpin for Ledger<OutAddress>
impl<OutAddress> UnwindSafe for Ledger<OutAddress>where OutAddress: RefUnwindSafe,
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