Struct concordium_std::test_infrastructure::ContextTest[][src]

pub struct ContextTest<'a, C> { /* fields omitted */ }
Expand description

Context used for testing. The type parameter C is used to determine whether this will be an init or receive context.

Implementations

impl<'a, C> ContextTest<'a, C>[src]

pub fn push_policy(&mut self, value: OwnedPolicy) -> &mut Self[src]

Push a new sender policy to the context. When the first policy is pushed this will set the policy vector to ‘Some’, even if it was undefined previously.

pub fn empty_policies(&mut self) -> &mut Self[src]

Set the policies to be defined, but an empty list. Such a situation can not realistically happen on the chain, but we provide functionality for it in case smart contract writers wish to program defensively.

pub fn set_parameter(&mut self, value: &'a [u8]) -> &mut Self[src]

pub fn metadata_mut(&mut self) -> &mut ChainMetaTest[src]

Get a mutable reference to the chain meta data placeholder

pub fn set_metadata_slot_time(&mut self, value: SlotTime) -> &mut Self[src]

Set the metadata block slot time

impl<'a> ContextTest<'a, InitOnlyDataTest>[src]

pub fn empty() -> Self[src]

Create an InitContextTest where every field is unset, and getting any of the fields will result in fail!.

pub fn set_init_origin(&mut self, value: AccountAddress) -> &mut Self[src]

Set init_origin in the InitContextTest

impl<'a> ContextTest<'a, ReceiveOnlyDataTest>[src]

pub fn empty() -> Self[src]

Create a ReceiveContextTest where every field is unset, and getting any of the fields will result in fail!.

pub fn set_invoker(&mut self, value: AccountAddress) -> &mut Self[src]

pub fn set_self_address(&mut self, value: ContractAddress) -> &mut Self[src]

pub fn set_self_balance(&mut self, value: Amount) -> &mut Self[src]

pub fn set_sender(&mut self, value: Address) -> &mut Self[src]

pub fn set_owner(&mut self, value: AccountAddress) -> &mut Self[src]

Trait Implementations

impl<'a, C: Clone> Clone for ContextTest<'a, C>[src]

fn clone(&self) -> ContextTest<'a, C>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a, C: Default> Default for ContextTest<'a, C>[src]

fn default() -> ContextTest<'a, C>[src]

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

impl<'a, C> HasCommonData for ContextTest<'a, C>[src]

type MetadataType = ChainMetaTest

type ParamType = Cursor<&'a [u8]>

type PolicyIteratorType = IntoIter<TestPolicy>

type PolicyType = TestPolicy

fn parameter_cursor(&self) -> Self::ParamType[src]

Get the cursor to the parameter.

fn metadata(&self) -> &Self::MetadataType[src]

Get the reference to chain metadata

fn policies(&self) -> Self::PolicyIteratorType[src]

Policies of the sender of the message. For init methods this is the would-be creator of the contract, for the receive this is the policies of the immediate sender. Read more

Auto Trait Implementations

impl<'a, C> RefUnwindSafe for ContextTest<'a, C> where
    C: RefUnwindSafe

impl<'a, C> Send for ContextTest<'a, C> where
    C: Send

impl<'a, C> Sync for ContextTest<'a, C> where
    C: Sync

impl<'a, C> Unpin for ContextTest<'a, C> where
    C: Unpin

impl<'a, C> UnwindSafe for ContextTest<'a, C> where
    C: UnwindSafe

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

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.

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

Performs the conversion.

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.

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

Performs the conversion.