Skip to main content

Scope

Struct Scope 

Source
pub struct Scope<'a> { /* private fields */ }
Expand description

Arguments provided to a callable during its execution.

Implementations§

Source§

impl<'a> Scope<'a>

Source

pub fn data(&self) -> &[Option<ConstantDatum>]

Returns DATA values captured from the compiled source in encounter order.

Source

pub fn nargs(&self) -> usize

Returns the total number of argument register slots.

Source

pub fn get_pos(&self, arg: u8) -> LineCol

Returns the source position of the argument at arg.

arg is the logical argument index, matching the N in scope.get_*(N).

Source

pub fn get_type(&self, arg: u8) -> VarArgTag

Gets the type tag of the argument at arg.

Source

pub fn get_boolean(&self, arg: u8) -> bool

Gets the boolean value of the argument at arg.

Source

pub fn get_double(&self, arg: u8) -> f64

Gets the double value of the argument at arg.

Source

pub fn get_integer(&self, arg: u8) -> i32

Gets the integer value of the argument at arg.

Source

pub fn get_ref(&self, arg: u8) -> RegisterRef<'_, 'a>

Gets an immutable register reference from the argument at arg.

Source

pub fn get_mut_ref(&mut self, arg: u8) -> RegisterRefMut<'_, 'a>

Gets a mutable register reference from the argument at arg.

Source

pub fn get_string(&self, arg: u8) -> &str

Gets the string value of the argument at arg.

Source

pub fn last_error(&self) -> Option<(LineCol, &str)>

Returns the last error stored in the VM, if any.

Source

pub fn return_boolean(self, b: bool) -> CallResult<()>

Sets the return value of the function to b.

Always returns success. The returned value is only to support the idiomatic invocation return scope.return_boolean(...).

Source

pub fn return_double(self, d: f64) -> CallResult<()>

Sets the return value of the function to d.

Always returns success. The returned value is only to support the idiomatic invocation return scope.return_double(...).

Source

pub fn return_integer(self, i: i32) -> CallResult<()>

Sets the return value of the function to i.

Always returns success. The returned value is only to support the idiomatic invocation return scope.return_integer(...).

Source

pub fn return_string<S: Into<String>>(self, s: S) -> CallResult<()>

Sets the return value of the function to s.

Always returns success. The returned value is only to support the idiomatic invocation return scope.return_string(...).

Auto Trait Implementations§

§

impl<'a> Freeze for Scope<'a>

§

impl<'a> RefUnwindSafe for Scope<'a>

§

impl<'a> Send for Scope<'a>

§

impl<'a> Sync for Scope<'a>

§

impl<'a> Unpin for Scope<'a>

§

impl<'a> UnsafeUnpin for Scope<'a>

§

impl<'a> !UnwindSafe for Scope<'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.