Struct EFuncContext

Source
pub struct EFuncContext<'a>(/* private fields */);

Implementations§

Source§

impl<'a> EFuncContext<'a>

Source

pub fn int(&mut self, i: i32)

Pushes an int to the stack

Source

pub fn float(&mut self, f: f64)

Pushes a float to the stack

Source

pub fn bool(&mut self, b: bool)

Pushes a bool to the stack

Source

pub fn null(&mut self)

Pushes null to the stack

Source

pub fn string(&mut self, s: &str)

Pushes a string to the stack

Source

pub fn symbol(&mut self, s: &str)

Pushes a symbol to the stack

Source

pub fn array(&mut self)

Pushes an empty array to the stack

Source

pub fn push_to_array(&mut self) -> Result<(), EFuncError>

Pops a value from the stack and pushes it to the array at the top of the stack

Source

pub fn object(&mut self)

Pushes an empty object instance to the stack

Source

pub fn set_object_property(&mut self, prop: &str) -> Result<(), EFuncError>

Pops a value from the stack and sets the property prop for the object instance at the top of the stack as the popped value

Source

pub fn as_int(&mut self) -> Result<i32, EFuncError>

Pops an int from the stack

Source

pub fn as_float(&mut self) -> Result<f64, EFuncError>

Pops a float from the stack

Source

pub fn as_bool(&mut self) -> Result<bool, EFuncError>

Pops a bool from the stack

Source

pub fn is_null(&mut self) -> Result<bool, EFuncError>

Pops a value from the stack and checks if it is null

Source

pub fn as_string(&mut self) -> Result<&str, EFuncError>

Pops a string from the top of the stack

Source

pub fn as_symbol(&mut self) -> Result<&str, EFuncError>

Pops a symbol from the top of the stack

Source

pub fn array_length(&mut self) -> Result<usize, EFuncError>

Gets the length of the array at the top of the stack

Source

pub fn get_element(&mut self, index: usize) -> Result<(), EFuncError>

Pushes the value at index of the array at the top of the stack

Source

pub fn get_property(&mut self, prop: &str) -> Result<(), EFuncError>

Pushes the value of property prop of the object at the top of the stack

Source

pub fn pop(&mut self) -> Result<(), EFuncError>

Pops the top of the stack

Source

pub fn map(&mut self)

Pushes an empty map to the stack

Source

pub fn insert_in_map(&mut self) -> Result<(), EFuncError>

Pops the value and then key from the stack and inserts it in the map at the top of the stack

Source

pub fn error( &mut self, module: &str, error_class: &str, message: &str, ) -> Result<(), EFuncError>

Pushes an error with class error_class within module module and with message message

Source

pub fn resource<T: 'static>(&mut self, t: T)

Source

pub fn as_resource<T: 'static>(&mut self) -> Result<&mut T, EFuncError>

Auto Trait Implementations§

§

impl<'a> Freeze for EFuncContext<'a>

§

impl<'a> RefUnwindSafe for EFuncContext<'a>

§

impl<'a> !Send for EFuncContext<'a>

§

impl<'a> !Sync for EFuncContext<'a>

§

impl<'a> Unpin for EFuncContext<'a>

§

impl<'a> UnwindSafe for EFuncContext<'a>

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.