Struct brane_dsl::symbol_table::FunctionEntry
source · pub struct FunctionEntry {
pub name: String,
pub signature: FunctionSignature,
pub params: Vec<Rc<RefCell<VarEntry>>>,
pub package_name: Option<String>,
pub package_version: Option<Version>,
pub class_name: Option<String>,
pub arg_names: Vec<String>,
pub requirements: Option<HashSet<Capability>>,
pub index: usize,
pub range: TextRange,
}
Expand description
Defines a function entry within the SymbolTable.
Fields§
§name: String
The name of the function entry.
signature: FunctionSignature
The signature of the function entry.
params: Vec<Rc<RefCell<VarEntry>>>
References to entries that form the Function’s parameters.
package_name: Option<String>
If set to non-zero, then this function is imported from a package with the given name.
package_version: Option<Version>
If set to non-zero, then this function is imported from a package with the given version.
class_name: Option<String>
If set to non-zero, then this function is a method in the class with the given name.
arg_names: Vec<String>
If this function is external (i.e., package_name
is not None), then this list represents the name of each of the arguments. It will thus always be as long as the number of arguments in that case (and empty otherwise).
requirements: Option<HashSet<Capability>>
Any requirements the function has in terms of hardware support. Only ever not-None if an external function.
index: usize
The index in the workflow buffer of this function.
range: TextRange
Points to the entire function definition (or import).
Implementations§
source§impl FunctionEntry
impl FunctionEntry
sourcepub fn from_builtin<S: Into<String>>(
name: S,
signature: FunctionSignature,
range: TextRange,
) -> Self
pub fn from_builtin<S: Into<String>>( name: S, signature: FunctionSignature, range: TextRange, ) -> Self
Creates a FunctionEntry as if it was defined as a builtin function.
§Generic arguments
S
: The String-like type of the function’sname
.
§Arguments
name
: The name of the FunctionEntry.signature
: The signature of the FunctionEntry.range
: The TextRange that points to the definition itself.
§Returns
A new FunctionEntry that has no package or class set, but does have type information populated.
sourcepub fn from_def<S: Into<String>>(name: S, range: TextRange) -> Self
pub fn from_def<S: Into<String>>(name: S, range: TextRange) -> Self
Creates a FunctionEntry as if it was defined in the source text.
§Generic arguments
S
: The String-like type of the function’sname
.
§Arguments
name
: The name of the FunctionEntry.range
: The TextRange that points to the definition itself.
§Returns
A new FunctionEntry that has no package or class set, and not yet any type information populated.
sourcepub fn from_import<S1: Into<String>, S2: Into<String>>(
name: S1,
signature: FunctionSignature,
package: S2,
package_version: Version,
arg_names: Vec<String>,
requirements: HashSet<Capability>,
range: TextRange,
) -> Self
pub fn from_import<S1: Into<String>, S2: Into<String>>( name: S1, signature: FunctionSignature, package: S2, package_version: Version, arg_names: Vec<String>, requirements: HashSet<Capability>, range: TextRange, ) -> Self
Creates a FunctionEntry as if it was imported by the given package.
§Generic arguments
S1
: The String-like type of the function’sname
.S2
: The String-like type of thepackage
.
§Arguments
name
: The name of the FunctionEntry.signature
: The FunctionSignature of this function.package
: The name of the package to which this function belongs.package_version
: The version of the package to which this function belongs.arg_names
: The names of the arguments (corresponds index-wise to thesignature::arg
list).requirements
: The list of hardware requirements (as Capabilities) as defined in the function’s package file.range
: The TextRange that points to the definition itself (i.e., the import statement).
§Returns
A new FunctionEntry that has the given package set, and not yet any type information populated.
sourcepub fn from_method<S1: Into<String>, S2: Into<String>>(
name: S1,
class: S2,
range: TextRange,
) -> Self
pub fn from_method<S1: Into<String>, S2: Into<String>>( name: S1, class: S2, range: TextRange, ) -> Self
Creates a FunctionEntry as if it was a class method.
§Generic arguments
S1
: The String-like type of the function’sname
.S2
: The String-like type of theclass
.
§Arguments
name
: The name of the FunctionEntry.class
: The name of the Class to which this function belongs.range
: The TextRange that points to the definition itself (i.e., the import statement).
§Returns
A new FunctionEntry that has the given class set, and not yet any type information populated.
Trait Implementations§
source§impl Clone for FunctionEntry
impl Clone for FunctionEntry
source§fn clone(&self) -> FunctionEntry
fn clone(&self) -> FunctionEntry
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for FunctionEntry
impl !RefUnwindSafe for FunctionEntry
impl !Send for FunctionEntry
impl !Sync for FunctionEntry
impl Unpin for FunctionEntry
impl !UnwindSafe for FunctionEntry
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request