Struct rgbstd::persistence::stock::Stock

source ·
pub struct Stock { /* private fields */ }
Expand description

Stock is an in-memory inventory (stash, index, contract state) useful for WASM implementations.

Can hold data about up to 256 contracts.

Implementations§

source§

impl Stock

source

pub fn debug_hoard(&self) -> &Hoard

Method borrowing Stock::hoard field.

source

pub fn debug_history(&self) -> &TinyOrdMap<ContractId, ContractHistory>

Method borrowing Stock::history field.

source

pub fn debug_bundle_op_index(&self) -> &MediumOrdMap<OpId, IndexedBundle>

Method borrowing Stock::bundle_op_index field.

source

pub fn debug_anchor_bundle_index(&self) -> &MediumOrdMap<BundleId, AnchorId>

Method borrowing Stock::anchor_bundle_index field.

source

pub fn debug_contract_index(&self) -> &TinyOrdMap<ContractId, ContractIndex>

Method borrowing Stock::contract_index field.

source

pub fn debug_terminal_index(&self) -> &MediumOrdMap<SecretSeal, Opout>

Method borrowing Stock::terminal_index field.

source

pub fn debug_seal_secrets(&self) -> &MediumOrdSet<GraphSeal>

Method borrowing Stock::seal_secrets field.

Methods from Deref<Target = Hoard>§

source

pub fn consume_consignment<const TYPE: bool>( &mut self, consignment: Consignment<TYPE> ) -> Result<(), ConsumeError>

source

pub fn consume_bundle( &mut self, bundle: TransitionBundle ) -> Result<(), ConsumeError>

source

pub fn consume_anchor( &mut self, anchor: Anchor<MerkleBlock> ) -> Result<(), ConsumeError>

Trait Implementations§

source§

impl Clone for Stock

source§

fn clone(&self) -> Stock

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Stock

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Stock

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Deref for Stock

§

type Target = Hoard

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl DerefMut for Stock

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl Inventory for Stock

§

type Stash = Hoard

§

type Error = Infallible

Error type which must indicate problems on data retrieval.
source§

fn stash(&self) -> &Self::Stash

source§

fn import_sigs<I>( &mut self, content_id: ContentId, sigs: I ) -> Result<(), InventoryDataError<Self::Error>>where I: IntoIterator<Item = Cert>, I::IntoIter: ExactSizeIterator<Item = Cert>,

source§

fn import_schema( &mut self, schema: impl Into<Bindle<SubSchema>> ) -> Result<Status, InventoryDataError<Self::Error>>

source§

fn import_iface( &mut self, iface: impl Into<Bindle<Iface>> ) -> Result<Status, InventoryDataError<Self::Error>>

source§

fn import_iface_impl( &mut self, iimpl: impl Into<Bindle<IfaceImpl>> ) -> Result<Status, InventoryDataError<Self::Error>>

source§

fn import_contract<R: ResolveHeight>( &mut self, contract: Contract, resolver: &mut R ) -> Result<Status, InventoryError<Self::Error>>where R::Error: 'static,

source§

fn accept_transfer<R: ResolveHeight>( &mut self, transfer: Transfer, resolver: &mut R, force: bool ) -> Result<Status, InventoryError<Self::Error>>where R::Error: 'static,

source§

fn consume_anchor( &mut self, anchor: Anchor<MerkleBlock> ) -> Result<(), InventoryError<Self::Error>>

Safety Read more
source§

fn consume_bundle( &mut self, contract_id: ContractId, bundle: TransitionBundle, witness_txid: Txid ) -> Result<(), InventoryError<<Self as Inventory>::Error>>

Safety Read more
source§

unsafe fn import_contract_force<R: ResolveHeight>( &mut self, contract: Contract, resolver: &mut R ) -> Result<Status, InventoryError<Self::Error>>where R::Error: 'static,

Safety Read more
source§

fn contract_iface( &mut self, contract_id: ContractId, iface_id: IfaceId ) -> Result<ContractIface, InventoryError<Self::Error>>

source§

fn transition( &self, opid: OpId ) -> Result<&Transition, InventoryError<Self::Error>>

source§

fn anchored_bundle( &self, opid: OpId ) -> Result<AnchoredBundle, InventoryError<Self::Error>>

source§

fn contracts_by_outpoints( &mut self, outpoints: impl IntoIterator<Item = impl Into<Outpoint>> ) -> Result<BTreeSet<ContractId>, InventoryError<Self::Error>>

source§

fn public_opouts( &mut self, contract_id: ContractId ) -> Result<BTreeSet<Opout>, InventoryError<Self::Error>>

source§

fn opouts_by_outpoints( &mut self, contract_id: ContractId, outpoints: impl IntoIterator<Item = impl Into<Outpoint>> ) -> Result<BTreeSet<Opout>, InventoryError<Self::Error>>

source§

fn opouts_by_terminals( &mut self, terminals: impl IntoIterator<Item = SecretSeal> ) -> Result<BTreeSet<Opout>, InventoryError<Self::Error>>

source§

fn state_for_outpoints( &mut self, contract_id: ContractId, outpoints: impl IntoIterator<Item = impl Into<Outpoint>> ) -> Result<BTreeMap<Opout, TypedState>, InventoryError<Self::Error>>

source§

fn store_seal_secret( &mut self, seal: GraphSeal ) -> Result<(), InventoryError<Self::Error>>

source§

fn seal_secrets( &mut self ) -> Result<BTreeSet<GraphSeal>, InventoryError<Self::Error>>

source§

fn contracts_with_iface( &mut self, iface: impl Into<TypeName> ) -> Result<Vec<ContractIface>, InventoryError<Self::Error>>where Self::Error: From<<Self::Stash as Stash>::Error>, InventoryError<Self::Error>: From<<Self::Stash as Stash>::Error>,

source§

fn contract_iface_named( &mut self, contract_id: ContractId, iface: impl Into<TypeName> ) -> Result<ContractIface, InventoryError<Self::Error>>where Self::Error: From<<Self::Stash as Stash>::Error>, InventoryError<Self::Error>: From<<Self::Stash as Stash>::Error>,

source§

fn transition_builder( &mut self, contract_id: ContractId, iface: impl Into<TypeName>, transition_name: Option<impl Into<TypeName>> ) -> Result<TransitionBuilder, InventoryError<Self::Error>>where Self::Error: From<<Self::Stash as Stash>::Error>,

source§

fn blank_builder( &mut self, contract_id: ContractId, iface: impl Into<TypeName> ) -> Result<TransitionBuilder, InventoryError<Self::Error>>where Self::Error: From<<Self::Stash as Stash>::Error>,

source§

fn export_contract( &mut self, contract_id: ContractId ) -> Result<Bindle<Contract>, ConsignerError<Self::Error, <<Self as Deref>::Target as Stash>::Error>>

source§

fn transfer( &mut self, contract_id: ContractId, seals: impl IntoIterator<Item = impl Into<BuilderSeal<SingleBlindSeal>>> ) -> Result<Bindle<Transfer>, ConsignerError<Self::Error, <<Self as Deref>::Target as Stash>::Error>>

source§

fn consign<Seal: ExposedSeal, const TYPE: bool>( &mut self, contract_id: ContractId, seals: impl IntoIterator<Item = impl Into<BuilderSeal<Seal>>> ) -> Result<Consignment<TYPE>, ConsignerError<Self::Error, <<Self as Deref>::Target as Stash>::Error>>

source§

impl StrictDecode for Stock

source§

fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>

source§

fn strict_read(lim: usize, reader: impl Read) -> Result<Self, DecodeError>

source§

impl StrictDeserialize for Stock

source§

fn from_strict_serialized<const MAX: usize>( ast_data: Confined<Vec<u8, Global>, 0, MAX> ) -> Result<Self, DeserializeError>

source§

fn strict_deserialize_from_file<const MAX: usize>( path: impl AsRef<Path> ) -> Result<Self, DeserializeError>

source§

impl StrictEncode for Stock

source§

fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>

source§

fn strict_write(&self, lim: usize, writer: impl Write) -> Result<usize, Error>

source§

impl StrictSerialize for Stock

source§

impl StrictStruct for Stock

source§

impl StrictType for Stock

source§

const STRICT_LIB_NAME: &'static str = LIB_NAME_RGB_STD

source§

fn strict_name() -> Option<TypeName>

source§

impl StrictProduct for Stock

Auto Trait Implementations§

§

impl RefUnwindSafe for Stock

§

impl Send for Stock

§

impl Sync for Stock

§

impl Unpin for Stock

§

impl UnwindSafe for Stock

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> StrictDumb for Twhere T: StrictType + Default,

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V