pub struct Function {
pub name: Token,
/* private fields */
}
Expand description
Represents a function. This is a struct that wraps the function’s name, parameters, and body. It also contains a reference to the environment in which it was defined.
Fields§
§name: Token
Implementations§
Trait Implementations§
Source§impl Callable for Function
impl Callable for Function
Source§fn call(
&self,
interpreter: &mut Interpreter<'_>,
arguments: Vec<Object>,
) -> Result<Object, RuntimeError>
fn call( &self, interpreter: &mut Interpreter<'_>, arguments: Vec<Object>, ) -> Result<Object, RuntimeError>
Calls the function (or method) and returns its return value.
Function returns are handled by a special return type (ReturnError
).
A closure is created for the function’s environment and arguments are bound to it.
Note: Initializer methods will return the instance that they were called on.
Auto Trait Implementations§
impl Freeze for Function
impl !RefUnwindSafe for Function
impl !Send for Function
impl !Sync for Function
impl Unpin for Function
impl !UnwindSafe for Function
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
Mutably borrows from an owned value. Read more