pub enum StateMutability {
Pure,
View,
NonPayable,
Payable,
}Expand description
A JSON ABI function’s state mutability.
This will serialize/deserialize as the stateMutability JSON ABI field’s value, see
as_json_str.
For backwards compatible deserialization, see serde_state_mutability_compat.
Variants§
Pure
Pure functions promise not to read from or modify the state.
View
View functions promise not to modify the state.
NonPayable
Nonpayable functions promise not to receive Ether.
This is the solidity default: https://docs.soliditylang.org/en/latest/abi-spec.html#json
The state mutability nonpayable is reflected in Solidity by not specifying a state mutability modifier at all.
Payable
Payable functions make no promises.
Implementations§
Source§impl StateMutability
impl StateMutability
Sourcepub fn parse(s: &str) -> Option<StateMutability>
pub fn parse(s: &str) -> Option<StateMutability>
Parses a state mutability from a string.
Sourcepub const fn as_str(self) -> Option<&'static str>
pub const fn as_str(self) -> Option<&'static str>
Returns the string representation of the state mutability.
Sourcepub const fn as_json_str(self) -> &'static str
pub const fn as_json_str(self) -> &'static str
Returns the string representation of the state mutability when serialized to JSON.
Trait Implementations§
Source§impl Clone for StateMutability
impl Clone for StateMutability
Source§fn clone(&self) -> StateMutability
fn clone(&self) -> StateMutability
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more