Struct 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

Source§

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

Source§

type Stash = Hoard

Source§

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>, 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 Freeze for Stock

§

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 T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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 T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V