pub struct RefValue { /* private fields */ }
Implementations§
source§impl RefValue
impl RefValue
sourcepub fn ref_or_copy(self) -> Self
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.
sourcepub fn create_method(&self, method_name: &str) -> Result<RefValue, Error>
pub fn create_method(&self, method_name: &str) -> Result<RefValue, Error>
Creates a callable Method object from a RefValue and a given method name.
sourcepub fn call_method(
&self,
name: &str,
context: Option<&mut Context<'_, '_, '_, '_>>,
args: Vec<RefValue>
) -> Result<Option<RefValue>, String>
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.
pub fn unary_op(self, op: &str) -> Result<RefValue, String>
pub fn binary_op(self, operand: RefValue, op: &str) -> Result<RefValue, String>
Trait Implementations§
source§impl From<Box<dyn Object>> for RefValue
impl From<Box<dyn Object>> for RefValue
source§fn from(value: BoxedObject) -> Self
fn from(value: BoxedObject) -> Self
Converts to this type from the input type.
source§impl Object for RefValue
impl Object for RefValue
source§fn is_callable(&self, without_arguments: bool) -> bool
fn is_callable(&self, without_arguments: bool) -> bool
Check whether the object is callable.
source§fn is_consuming(&self) -> bool
fn is_consuming(&self) -> bool
Check whether the object is consuming
source§fn is_nullable(&self) -> bool
fn is_nullable(&self) -> bool
Check whether the object is nullable
source§fn is_mutable(&self) -> bool
fn is_mutable(&self) -> bool
Check whether the object is mutable in itself. Read more
source§fn is_hashable(&self) -> bool
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>
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§impl Ord for RefValue
impl Ord for RefValue
source§impl PartialEq for RefValue
impl PartialEq for RefValue
source§impl PartialOrd for RefValue
impl PartialOrd for RefValue
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moreimpl Eq for RefValue
impl StructuralEq for RefValue
impl StructuralPartialEq for RefValue
Auto Trait Implementations§
impl !RefUnwindSafe for RefValue
impl !Send for RefValue
impl !Sync for RefValue
impl Unpin for RefValue
impl !UnwindSafe for RefValue
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
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
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.