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
impl Stock
sourcepub fn debug_hoard(&self) -> &Hoard
pub fn debug_hoard(&self) -> &Hoard
Method borrowing Stock::hoard field.
sourcepub fn debug_history(&self) -> &TinyOrdMap<ContractId, ContractHistory>
pub fn debug_history(&self) -> &TinyOrdMap<ContractId, ContractHistory>
Method borrowing Stock::history field.
sourcepub fn debug_bundle_op_index(&self) -> &MediumOrdMap<OpId, IndexedBundle>
pub fn debug_bundle_op_index(&self) -> &MediumOrdMap<OpId, IndexedBundle>
Method borrowing Stock::bundle_op_index field.
sourcepub fn debug_anchor_bundle_index(&self) -> &MediumOrdMap<BundleId, AnchorId>
pub fn debug_anchor_bundle_index(&self) -> &MediumOrdMap<BundleId, AnchorId>
Method borrowing Stock::anchor_bundle_index field.
sourcepub fn debug_contract_index(&self) -> &TinyOrdMap<ContractId, ContractIndex>
pub fn debug_contract_index(&self) -> &TinyOrdMap<ContractId, ContractIndex>
Method borrowing Stock::contract_index field.
sourcepub fn debug_terminal_index(&self) -> &MediumOrdMap<SecretSeal, Opout>
pub fn debug_terminal_index(&self) -> &MediumOrdMap<SecretSeal, Opout>
Method borrowing Stock::terminal_index field.
sourcepub fn debug_seal_secrets(&self) -> &MediumOrdSet<GraphSeal>
pub fn debug_seal_secrets(&self) -> &MediumOrdSet<GraphSeal>
Method borrowing Stock::seal_secrets field.
Methods from Deref<Target = Hoard>§
pub fn consume_consignment<const TYPE: bool>( &mut self, consignment: Consignment<TYPE> ) -> Result<(), ConsumeError>
pub fn consume_bundle( &mut self, bundle: TransitionBundle ) -> Result<(), ConsumeError>
pub fn consume_anchor( &mut self, anchor: Anchor<MerkleBlock> ) -> Result<(), ConsumeError>
Trait Implementations§
source§impl Inventory for Stock
impl Inventory for Stock
type Stash = Hoard
§type Error = Infallible
type Error = Infallible
Error type which must indicate problems on data retrieval.
fn stash(&self) -> &Self::Stash
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>,
fn import_schema( &mut self, schema: impl Into<Bindle<SubSchema>> ) -> Result<Status, InventoryDataError<Self::Error>>
fn import_iface( &mut self, iface: impl Into<Bindle<Iface>> ) -> Result<Status, InventoryDataError<Self::Error>>
fn import_iface_impl( &mut self, iimpl: impl Into<Bindle<IfaceImpl>> ) -> Result<Status, InventoryDataError<Self::Error>>
fn import_contract<R: ResolveHeight>( &mut self, contract: Contract, resolver: &mut R ) -> Result<Status, InventoryError<Self::Error>>where R::Error: 'static,
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>>
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>>
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,
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
fn contract_iface( &mut self, contract_id: ContractId, iface_id: IfaceId ) -> Result<ContractIface, InventoryError<Self::Error>>
fn transition( &self, opid: OpId ) -> Result<&Transition, InventoryError<Self::Error>>
fn anchored_bundle( &self, opid: OpId ) -> Result<AnchoredBundle, InventoryError<Self::Error>>
fn contracts_by_outpoints( &mut self, outpoints: impl IntoIterator<Item = impl Into<Outpoint>> ) -> Result<BTreeSet<ContractId>, InventoryError<Self::Error>>
fn public_opouts( &mut self, contract_id: ContractId ) -> Result<BTreeSet<Opout>, InventoryError<Self::Error>>
fn opouts_by_outpoints( &mut self, contract_id: ContractId, outpoints: impl IntoIterator<Item = impl Into<Outpoint>> ) -> Result<BTreeSet<Opout>, InventoryError<Self::Error>>
fn opouts_by_terminals( &mut self, terminals: impl IntoIterator<Item = SecretSeal> ) -> Result<BTreeSet<Opout>, InventoryError<Self::Error>>
fn state_for_outpoints( &mut self, contract_id: ContractId, outpoints: impl IntoIterator<Item = impl Into<Outpoint>> ) -> Result<BTreeMap<Opout, TypedState>, InventoryError<Self::Error>>
fn store_seal_secret( &mut self, seal: GraphSeal ) -> Result<(), InventoryError<Self::Error>>
fn seal_secrets( &mut self ) -> Result<BTreeSet<GraphSeal>, InventoryError<Self::Error>>
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>,
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>,
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>,
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>,
fn export_contract( &mut self, contract_id: ContractId ) -> Result<Bindle<Contract>, ConsignerError<Self::Error, <<Self as Deref>::Target as Stash>::Error>>
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>>
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
impl StrictDecode for Stock
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(lim: usize, reader: impl Read) -> Result<Self, DecodeError>
source§impl StrictDeserialize for Stock
impl StrictDeserialize for Stock
fn from_strict_serialized<const MAX: usize>( ast_data: Confined<Vec<u8, Global>, 0, MAX> ) -> Result<Self, DeserializeError>
fn strict_deserialize_from_file<const MAX: usize>( path: impl AsRef<Path> ) -> Result<Self, DeserializeError>
source§impl StrictEncode for Stock
impl StrictEncode for Stock
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, lim: usize, writer: impl Write) -> Result<usize, Error>
source§impl StrictSerialize for Stock
impl StrictSerialize for Stock
fn strict_serialized_len(&self) -> Result<usize, Error>
fn to_strict_serialized<const MAX: usize>( &self ) -> Result<Confined<Vec<u8, Global>, 0, MAX>, SerializeError>
fn strict_serialize_to_file<const MAX: usize>( &self, path: impl AsRef<Path> ) -> Result<(), SerializeError>
source§impl StrictStruct for Stock
impl StrictStruct for Stock
const ALL_FIELDS: &'static [&'static str] = _
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
source§impl StrictType for Stock
impl StrictType for Stock
const STRICT_LIB_NAME: &'static str = LIB_NAME_RGB_STD
fn strict_name() -> Option<TypeName>
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> 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