Struct ethers_solc::artifacts::ast::FunctionDefinition
source · pub struct FunctionDefinition {Show 21 fields
pub id: usize,
pub src: SourceLocation,
pub name: String,
pub name_location: Option<SourceLocation>,
pub base_functions: Vec<usize>,
pub body: Option<Block>,
pub documentation: Option<StructuredDocumentation>,
pub function_selector: Option<String>,
pub implemented: bool,
pub modifiers: Vec<ModifierInvocation>,
pub overrides: Option<OverrideSpecifier>,
pub parameters: ParameterList,
pub return_parameters: ParameterList,
pub scope: usize,
pub visibility: Visibility,
pub kind: Option<FunctionKind>,
pub state_mutability: Option<StateMutability>,
pub is_virtual: bool,
pub is_constructor: bool,
pub is_declared_const: bool,
pub is_payable: bool,
}
Expand description
A function definition.
Fields§
§id: usize
§src: SourceLocation
§name: String
§name_location: Option<SourceLocation>
§base_functions: Vec<usize>
§body: Option<Block>
§documentation: Option<StructuredDocumentation>
§function_selector: Option<String>
§implemented: bool
§modifiers: Vec<ModifierInvocation>
§overrides: Option<OverrideSpecifier>
§parameters: ParameterList
§return_parameters: ParameterList
§scope: usize
§visibility: Visibility
§kind: Option<FunctionKind>
The kind of function this node defines. Only valid for Solidity versions 0.5.x and above.
For cross-version compatibility use FunctionDefinition::kind()
.
state_mutability: Option<StateMutability>
The state mutability of the function.
Note: This was introduced in Solidity 0.5.x. For cross-version compatibility use
FunctionDefinition::state_mutability()
.
is_virtual: bool
§is_constructor: bool
Whether or not this function is the constructor. Only valid for Solidity versions below 0.5.x.
After 0.5.x you must use kind
. For cross-version compatibility use
FunctionDefinition::kind()
.
is_declared_const: bool
Whether or not this function is constant (view or pure). Only valid for Solidity versions below 0.5.x.
After 0.5.x you must use state_mutability
. For cross-version compatibility use
FunctionDefinition::state_mutability()
.
is_payable: bool
Whether or not this function is payable. Only valid for Solidity versions below 0.5.x.
After 0.5.x you must use state_mutability
. For cross-version compatibility use
FunctionDefinition::state_mutability()
.
Implementations§
source§impl FunctionDefinition
impl FunctionDefinition
sourcepub fn kind(&self) -> &FunctionKind
pub fn kind(&self) -> &FunctionKind
The kind of function this node defines.
sourcepub fn state_mutability(&self) -> &StateMutability
pub fn state_mutability(&self) -> &StateMutability
The state mutability of the function.
Note: Before Solidity 0.5.x, this is an approximation, as there was no distinction between
view
and pure
.
Trait Implementations§
source§impl Clone for FunctionDefinition
impl Clone for FunctionDefinition
source§fn clone(&self) -> FunctionDefinition
fn clone(&self) -> FunctionDefinition
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FunctionDefinition
impl Debug for FunctionDefinition
source§impl<'de> Deserialize<'de> for FunctionDefinition
impl<'de> Deserialize<'de> for FunctionDefinition
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>,
source§impl PartialEq for FunctionDefinition
impl PartialEq for FunctionDefinition
source§fn eq(&self, other: &FunctionDefinition) -> bool
fn eq(&self, other: &FunctionDefinition) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for FunctionDefinition
impl Serialize for FunctionDefinition
impl Eq for FunctionDefinition
impl StructuralPartialEq for FunctionDefinition
Auto Trait Implementations§
impl RefUnwindSafe for FunctionDefinition
impl Send for FunctionDefinition
impl Sync for FunctionDefinition
impl Unpin for FunctionDefinition
impl UnwindSafe for FunctionDefinition
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<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.