Commit f7be0c59 authored by Hero Bird's avatar Hero Bird

[pdsl_model] Add direct message calls.

These are mainly useful for testing of contracts.
parent 284e5463
......@@ -345,5 +345,23 @@ where
.ok()
.expect("trapped during message dispatch");
}
/// Calls the given message with its expected input arguments.
///
/// # Note
///
/// Takes `&mut self` since it could potentially call a message
/// that mutates state. There currently is no separation between
/// messages that mutate state and those that don't.
///
/// # Panics
///
/// If the contract has no message handler setup for the given message.
pub fn call<Msg>(&mut self, input: <Msg as Message>::Input)
where
Msg: Message,
<Msg as Message>::Input: parity_codec::Encode,
{
self.call_with(CallData::from_msg::<Msg>(input))
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment