pub struct Action {
pub account: AccountName,
pub name: ActionName,
pub authorization: Vec<PermissionLevel>,
pub data: Bytes,
}Expand description
An action is performed by an actor, aka an account. It may be created explicitly and authorized by signatures or might be generated implicitly by executing application code.
This follows the design pattern of React Flux where actions are named and then dispatched to one or more action handlers (aka stores). In the context of eosio, every action is dispatched to the handler defined by account ‘scope’ and function ‘name’, but the default handler may also forward the action to any number of additional handlers. Any application can write a handler for “scope::name” that will get executed if and only if this action is forwarded to that application.
Each action may require the permission of specific actors. Actors can define any number of permission levels. The actors and their respective permission levels are declared on the action and validated independently of the executing application code. An application code will check to see if the required authorization were properly declared when it executes.
Fields§
§account: AccountName§name: ActionName§data: BytesImplementations§
Source§impl Action
impl Action
pub fn new<T: Contract>( authorization: impl IntoPermissionVec, contract: &T, ) -> Action
pub fn conv_action_field_str<'a>( action: &'a JsonValue, field: &str, ) -> Result<&'a str, ActionError>
pub fn from_json( abi_provider: Option<&ABIProvider>, action: &JsonValue, ) -> Result<Action, ActionError>
pub fn from_json_array( abi_provider: Option<&ABIProvider>, actions: &JsonValue, ) -> Result<Vec<Action>, ActionError>
pub fn decode_data(&self, abi_provider: &ABIProvider) -> JsonValue
pub fn with_data(self, abi_provider: &ABIProvider, value: &JsonValue) -> Self
pub fn to_json(&self, abi_provider: &ABIProvider) -> JsonValue
Trait Implementations§
Source§impl ABISerializable for Action
impl ABISerializable for Action
fn to_bin(&self, s: &mut ByteStream)
fn from_bin(s: &mut ByteStream) -> Result<Self, SerializeError>
Source§impl<'de> Deserialize<'de> for Action
impl<'de> Deserialize<'de> for Action
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Action
impl StructuralPartialEq for Action
Auto Trait Implementations§
impl Freeze for Action
impl RefUnwindSafe for Action
impl Send for Action
impl Sync for Action
impl Unpin for Action
impl UnsafeUnpin for Action
impl UnwindSafe for Action
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.