[][src]Struct cosmwasm_vm::Instance

pub struct Instance<S: Storage + 'static, A: Api + 'static, Q: Querier + 'static> {
    pub api: A,
    pub required_features: HashSet<String>,
    // some fields omitted
}

Fields

api: Arequired_features: HashSet<String>

Implementations

impl<S, A, Q> Instance<S, A, Q> where
    S: Storage + 'static,
    A: Api + 'static,
    Q: Querier + 'static, 
[src]

pub fn from_code(
    code: &[u8],
    deps: Extern<S, A, Q>,
    gas_limit: u64
) -> VmResult<Self>
[src]

This is the only Instance constructor that can be called from outside of cosmwasm-vm, e.g. in test code that needs a customized variant of cosmwasm_vm::testing::mock_instance*.

pub fn recycle(self) -> Option<Extern<S, A, Q>>[src]

Decomposes this instance into its components. External dependencies are returned for reuse, the rest is dropped.

pub fn get_memory_size(&self) -> u64[src]

Returns the size of the default memory in bytes. This provides a rough idea of the peak memory consumption. Note that Wasm memory always grows in 64 KiB steps (pages) and can never shrink (https://github.com/WebAssembly/design/issues/1300#issuecomment-573867836).

pub fn get_gas_left(&self) -> u64[src]

Returns the currently remaining gas.

pub fn set_storage_readonly(&mut self, new_value: bool)[src]

Sets the readonly storage flag on this instance. Since one instance can be used for multiple calls in integration tests, this should be set to the desired value right before every call.

pub fn with_storage<F: FnOnce(&mut S) -> VmResult<T>, T>(
    &mut self,
    func: F
) -> VmResult<T>
[src]

pub fn with_querier<F: FnOnce(&mut Q) -> VmResult<T>, T>(
    &mut self,
    func: F
) -> VmResult<T>
[src]

Auto Trait Implementations

impl<S, A, Q> !RefUnwindSafe for Instance<S, A, Q>

impl<S, A, Q> Send for Instance<S, A, Q> where
    Q: Send,
    S: Send

impl<S, A, Q> !Sync for Instance<S, A, Q>

impl<S, A, Q> Unpin for Instance<S, A, Q> where
    A: Unpin,
    Q: Unpin,
    S: Unpin

impl<S, A, Q> !UnwindSafe for Instance<S, A, Q>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.