pub struct NativeFunction {
pub name: Token,
/* private fields */
}
Expand description
Represents a native function. This is a special type of function that is used to implement built-in functions. These functions are external to the language and are implemented in Rust. They are used to provide access to the host environment.
Native functions are defined in the
NativeFunction::get_globals
method and used
during the initialization of the Interpreter
.
These functions will be available to the user in the global scope.
Current native functions:
clock()
- Returns the current time in milliseconds.input()
- Reads a line of string from the standard input.
Fields§
§name: Token
Implementations§
Source§impl NativeFunction
impl NativeFunction
Sourcepub fn get_globals() -> Vec<NativeFunction>
pub fn get_globals() -> Vec<NativeFunction>
Returns a list of native functions with their implementations.
Trait Implementations§
Source§impl Callable for NativeFunction
impl Callable for NativeFunction
Source§impl Clone for NativeFunction
impl Clone for NativeFunction
Source§fn clone(&self) -> NativeFunction
fn clone(&self) -> NativeFunction
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for NativeFunction
impl Debug for NativeFunction
Source§impl Display for NativeFunction
impl Display for NativeFunction
Source§impl From<NativeFunction> for Object
impl From<NativeFunction> for Object
Source§fn from(value: NativeFunction) -> Self
fn from(value: NativeFunction) -> Self
Converts to this type from the input type.
Source§impl PartialEq for NativeFunction
impl PartialEq for NativeFunction
Auto Trait Implementations§
impl Freeze for NativeFunction
impl RefUnwindSafe for NativeFunction
impl Send for NativeFunction
impl Sync for NativeFunction
impl Unpin for NativeFunction
impl UnwindSafe for NativeFunction
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