Struct tokay::value::RefValue

source ·
pub struct RefValue { /* private fields */ }

Implementations§

source§

impl RefValue

source

pub fn ref_or_copy(self) -> Self

Either creates a copy of a value or a reference, which is configured by the is_mutable() function of the underlying object.

source

pub fn create_method(&self, method_name: &str) -> Result<RefValue, Error>

Creates a callable Method object from a RefValue and a given method name.

source

pub fn call_method( &self, name: &str, context: Option<&mut Context<'_, '_, '_, '_>>, args: Vec<RefValue> ) -> Result<Option<RefValue>, String>

Performs a direct method call on a value.

This function is designed to invoke methods on values directly from Rust code.

source

pub fn unary_op(self, op: &str) -> Result<RefValue, String>

source

pub fn binary_op(self, operand: RefValue, op: &str) -> Result<RefValue, String>

Trait Implementations§

source§

impl Clone for RefValue

source§

fn clone(&self) -> RefValue

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RefValue

source§

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

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

impl Deref for RefValue

§

type Target = Rc<RefCell<Value>>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl DerefMut for RefValue

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl From<&'static Builtin> for RefValue

source§

fn from(builtin: &'static Builtin) -> Self

Converts to this type from the input type.
source§

impl From<&RefValue> for List

source§

fn from(refvalue: &RefValue) -> Self

Converts to this type from the input type.
source§

impl From<&str> for RefValue

source§

fn from(string: &str) -> Self

Converts to this type from the input type.
source§

impl From<BigInt> for RefValue

source§

fn from(int: BigInt) -> Self

Converts to this type from the input type.
source§

impl From<Box<dyn Object>> for RefValue

source§

fn from(value: BoxedObject) -> Self

Converts to this type from the input type.
source§

impl From<Dict> for RefValue

source§

fn from(value: Dict) -> Self

Converts to this type from the input type.
source§

impl From<Iter> for RefValue

source§

fn from(iter: Iter) -> Self

Converts to this type from the input type.
source§

impl From<List> for RefValue

source§

fn from(value: List) -> Self

Converts to this type from the input type.
source§

impl From<Method> for RefValue

source§

fn from(method: Method) -> Self

Converts to this type from the input type.
source§

impl From<RefValue> for Capture

source§

fn from(value: RefValue) -> Self

Converts to this type from the input type.
source§

impl From<RefValue> for List

source§

fn from(refvalue: RefValue) -> Self

Converts to this type from the input type.
source§

impl From<RefValue> for Result<Accept, Reject>

source§

fn from(value: RefValue) -> Self

Converts to this type from the input type.
source§

impl From<RefValue> for Value

source§

fn from(value: RefValue) -> Self

Converts to this type from the input type.
source§

impl From<Str> for RefValue

source§

fn from(string: Str) -> Self

Converts to this type from the input type.
source§

impl From<String> for RefValue

source§

fn from(string: String) -> Self

Converts to this type from the input type.
source§

impl From<Token> for RefValue

source§

fn from(token: Token) -> Self

Converts to this type from the input type.
source§

impl From<Value> for RefValue

source§

fn from(value: Value) -> Self

Converts to this type from the input type.
source§

impl From<Vec<RefValue>> for RefValue

source§

fn from(list: Vec<RefValue>) -> Self

Converts to this type from the input type.
source§

impl From<bool> for RefValue

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl From<char> for RefValue

source§

fn from(ch: char) -> Self

Converts to this type from the input type.
source§

impl From<f32> for RefValue

source§

fn from(float: f32) -> Self

Converts to this type from the input type.
source§

impl From<f64> for RefValue

source§

fn from(float: f64) -> Self

Converts to this type from the input type.
source§

impl From<i32> for RefValue

source§

fn from(int: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for RefValue

source§

fn from(int: i64) -> Self

Converts to this type from the input type.
source§

impl From<u32> for RefValue

source§

fn from(int: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for RefValue

source§

fn from(int: u64) -> Self

Converts to this type from the input type.
source§

impl From<usize> for RefValue

source§

fn from(addr: usize) -> Self

Converts to this type from the input type.
source§

impl Hash for RefValue

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Object for RefValue

source§

fn id(&self) -> usize

Object ID (unique memory address)
source§

fn severity(&self) -> u8

Object severity
source§

fn name(&self) -> &'static str

Object type name.
source§

fn repr(&self) -> String

Object representation in Tokay code
source§

fn is_void(&self) -> bool

Object as void
source§

fn is_true(&self) -> bool

Object as bool
source§

fn to_i64(&self) -> Result<i64, String>

Object as i64
source§

fn to_f64(&self) -> Result<f64, String>

Object as f64
source§

fn to_usize(&self) -> Result<usize, String>

Object as usize
source§

fn to_string(&self) -> String

Object as String
source§

fn to_bigint(&self) -> Result<BigInt, String>

Object as BigInt
source§

fn is_callable(&self, without_arguments: bool) -> bool

Check whether the object is callable.
source§

fn is_consuming(&self) -> bool

Check whether the object is consuming
source§

fn is_nullable(&self) -> bool

Check whether the object is nullable
source§

fn is_mutable(&self) -> bool

Check whether the object is mutable in itself. Read more
source§

fn is_hashable(&self) -> bool

Check whether the object is hashable. Read more
source§

fn call( &self, context: Option<&mut Context<'_, '_, '_, '_>>, args: Vec<RefValue>, nargs: Option<Dict> ) -> Result<Accept, Reject>

Call object with optional context, arguments and named arguments set.
source§

fn call_direct( &self, context: &mut Context<'_, '_, '_, '_>, args: usize, nargs: Option<Dict> ) -> Result<Accept, Reject>

Directly call object with a given stack configuration. Read more
source§

fn is(&self, name: &str) -> bool

Check for value type name.
source§

impl Ord for RefValue

source§

fn cmp(&self, other: &RefValue) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for RefValue

source§

fn eq(&self, other: &RefValue) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for RefValue

source§

fn partial_cmp(&self, other: &RefValue) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Eq for RefValue

source§

impl StructuralEq for RefValue

source§

impl StructuralPartialEq for RefValue

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
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.