pub struct FunctionDefinition {
pub function: FunctionHandleIndex,
pub visibility: Visibility,
pub acquires_global_resources: Vec<StructDefinitionIndex>,
pub code: Option<CodeUnit>,
}
Expand description
A FunctionDefinition
is the implementation of a function. It defines
the prototype of the function and the function body.
Fields§
§function: FunctionHandleIndex
The prototype of the function (module, name, signature).
visibility: Visibility
The visibility of this function.
acquires_global_resources: Vec<StructDefinitionIndex>
List of locally defined types (declared in this module) with the Key
ability
that the procedure might access, either through: BorrowGlobal, MoveFrom, or transitively
through another procedure
This list of acquires grants the borrow checker the ability to statically verify the safety
of references into global storage
Not in the signature as it is not needed outside of the declaring module
Note, there is no SignatureIndex with each struct definition index, so all instantiations of that type are considered as being acquired
code: Option<CodeUnit>
Code for this function.
Implementations§
Trait Implementations§
source§impl Arbitrary for FunctionDefinition
impl Arbitrary for FunctionDefinition
§type Parameters = usize
type Parameters = usize
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = Map<(<FunctionHandleIndex as Arbitrary>::Strategy, <Visibility as Arbitrary>::Strategy, <Vec<StructDefinitionIndex, Global> as Arbitrary>::Strategy, BoxedStrategy<Option<CodeUnit>>), fn(_: (FunctionHandleIndex, Visibility, Vec<StructDefinitionIndex, Global>, Option<CodeUnit>)) -> FunctionDefinition>
type Strategy = Map<(<FunctionHandleIndex as Arbitrary>::Strategy, <Visibility as Arbitrary>::Strategy, <Vec<StructDefinitionIndex, Global> as Arbitrary>::Strategy, BoxedStrategy<Option<CodeUnit>>), fn(_: (FunctionHandleIndex, Visibility, Vec<StructDefinitionIndex, Global>, Option<CodeUnit>)) -> FunctionDefinition>
Strategy
used to generate values of type Self
.source§fn arbitrary_with(_top: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_top: Self::Parameters) -> Self::Strategy
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 Default for FunctionDefinition
impl Default for FunctionDefinition
source§fn default() -> FunctionDefinition
fn default() -> FunctionDefinition
source§impl PartialEq<FunctionDefinition> for FunctionDefinition
impl PartialEq<FunctionDefinition> 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 ==
.