pub struct FunctionSignature {
pub meta: Option<Meta>,
pub name: String,
pub module_name: Option<String>,
pub type_handle: Option<Arc<Type>>,
pub visibility: Visibility,
pub inputs: Vec<FunctionParameter>,
pub outputs: Vec<FunctionParameter>,
}Expand description
Everything about a function except its body.
The signature is also the identity of a function: a registry refuses to hold two functions whose signatures are equal.
type_handle is set when the function belongs to a type, which is how
methods are modelled.
Fields§
§meta: Option<Meta>Metadata attached to this function.
name: StringName the function is registered under.
module_name: Option<String>Module the function belongs to.
type_handle: Option<Arc<Type>>Type the function is a method of, if any.
visibility: VisibilityHow widely the function is visible.
inputs: Vec<FunctionParameter>Arguments, in declaration order.
outputs: Vec<FunctionParameter>Results, in declaration order.
Implementations§
Source§impl FunctionSignature
impl FunctionSignature
Sourcepub fn new(name: impl ToString) -> FunctionSignature
pub fn new(name: impl ToString) -> FunctionSignature
Builds a signature with just a name.
Sourcepub fn with_meta(self, meta: Meta) -> FunctionSignature
pub fn with_meta(self, meta: Meta) -> FunctionSignature
Attaches metadata, builder style.
Sourcepub fn with_module_name(self, name: impl ToString) -> FunctionSignature
pub fn with_module_name(self, name: impl ToString) -> FunctionSignature
Sets the owning module, builder style.
Sourcepub fn with_type_handle(self, handle: Arc<Type>) -> FunctionSignature
pub fn with_type_handle(self, handle: Arc<Type>) -> FunctionSignature
Makes this a method of the given type, builder style.
Sourcepub fn with_visibility(self, visibility: Visibility) -> FunctionSignature
pub fn with_visibility(self, visibility: Visibility) -> FunctionSignature
Sets visibility, builder style.
Sourcepub fn with_input(self, parameter: FunctionParameter) -> FunctionSignature
pub fn with_input(self, parameter: FunctionParameter) -> FunctionSignature
Appends an input, builder style.
Sourcepub fn with_output(self, parameter: FunctionParameter) -> FunctionSignature
pub fn with_output(self, parameter: FunctionParameter) -> FunctionSignature
Appends an output, builder style.
Trait Implementations§
Source§impl Clone for FunctionSignature
impl Clone for FunctionSignature
Source§fn clone(&self) -> FunctionSignature
fn clone(&self) -> FunctionSignature
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more