Struct NativeFunction

Source
pub struct NativeFunction {
    pub name: String,
    pub func: Box<dyn Function>,
}
Expand description

NativeFunction

Fields§

§name: String§func: Box<dyn Function>

Implementations§

Source§

impl NativeFunction

Source

pub fn new(name: impl ToString, func: Box<dyn Function>) -> Self

Trait Implementations§

Source§

impl Debug for NativeFunction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Object for NativeFunction

Source§

fn call(&mut self, args: &[ValueRef]) -> Result<Option<Value>, RuntimeError>

Source§

fn debug(&self, f: &mut Formatter<'_>) -> Result

Source§

fn add(&self, other: &Value) -> Result<Value, RuntimeError>

arithmetic addition operation
Source§

fn sub(&self, other: &Value) -> Result<Value, RuntimeError>

arithmetic subtraction operation
Source§

fn mul(&self, other: &Value) -> Result<Value, RuntimeError>

arithmetic multiplication operation
Source§

fn div(&self, other: &Value) -> Result<Value, RuntimeError>

arithmetic division operation
Source§

fn modulo(&self, other: &Value) -> Result<Value, RuntimeError>

arithmetic modulo operation
Source§

fn pow(&self, other: &Value) -> Result<Value, RuntimeError>

arithmetic power operation
Source§

fn compare(&self, other: &Value) -> Result<Ordering, RuntimeError>

compare operation
Source§

fn logic_and(&self, other: &Value) -> Result<Value, RuntimeError>

logic and operation
Source§

fn logic_or(&self, other: &Value) -> Result<Value, RuntimeError>

logic or operation
Source§

fn negate(&self) -> Result<Value, RuntimeError>

negate operation
Source§

fn index_get(&self, index: &Value) -> Result<ValueRef, RuntimeError>

index get operation
Source§

fn index_set( &mut self, index: &Value, value: ValueRef, ) -> Result<(), RuntimeError>

Source§

fn property_get(&self, member: &str) -> Result<ValueRef, RuntimeError>

Source§

fn property_set( &mut self, member: &str, value: ValueRef, ) -> Result<(), RuntimeError>

Source§

fn property_call( &mut self, member: &str, args: &[ValueRef], ) -> Result<Option<Value>, RuntimeError>

Source§

fn make_iterator( &self, ) -> Result<Box<dyn Iterator<Item = ValueRef>>, RuntimeError>

Source§

fn iterator_has_next(&self) -> Result<bool, RuntimeError>

Source§

fn iterate_next(&mut self) -> Result<ValueRef, RuntimeError>

Source§

fn make_slice(&self, range: ValueRef) -> Result<Value, RuntimeError>

Source§

fn into_future( self: Box<Self>, ) -> Result<Box<dyn Future<Output = Value> + Unpin + Send + 'static>, RuntimeError>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.