Struct Object

Source
pub struct Object { /* private fields */ }
Expand description

A wrapper for Cell that provides type-specific operations with the Cell data.

You can construct this object using Cell::into_object.

To discover which operations are available for this Object, you can explore its Prototype using the Object::prototype function.

Implementations§

Source§

impl Object

Source

pub fn assign(self, origin: Origin, lhs: Origin, rhs: Arg) -> RuntimeResult<()>

Calls an assignment operator (lhs = rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “assign” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn component( self, origin: Origin, lhs: Origin, rhs: Ident, ) -> RuntimeResult<Cell>

Returns a Cell that points to a component of the object (e.g., an object’s method or a predefined field), such as foo.bar.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the name of the component/field. You can obtain the component’s identifier using, for example, the FieldSymbol::ident function.

The function returns a RuntimeError if the Object’s type does not have this component or if the component fetching implementation returns a RuntimeError.

Source

pub fn component_or_field( self, origin: Origin, lhs: Origin, rhs: Ident, ) -> RuntimeResult<Cell>

Similar to Object::component, but if the Object’s type does not have a component with the specified name, it falls back to Object::field.

Source

pub fn field( self, origin: Origin, lhs: Origin, rhs: Ident, ) -> RuntimeResult<Cell>

Returns a Cell that points to a field resolved at runtime, such as foo.bar.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the name of the field. You can obtain the field’s identifier using, for example, the FieldSymbol::ident function.

The function returns a RuntimeError if the Object’s type does not implement a runtime field resolver or if the resolver’s implementation returns a RuntimeError.

Source

pub fn clone(self, origin: Origin, rhs: Origin) -> RuntimeResult<Cell>

Calls a Clone operator (*foo) on this Object, creating a clone of the underlying Cell’s data.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The rhs parameter specifies the Rust or Script source code range that spans the operand (this Object).

The function returns a RuntimeError if the Object’s type does not support the “clone” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn debug( self, origin: Origin, lhs: Origin, formatter: &mut Formatter<'_>, ) -> RuntimeResult<()>

Calls a Debug operator on this Object to format the underlying Cell’s data for debugging purposes.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the operand (this Object).

The formatter parameter specifies the Rust Formatter that will be passed to the Debug::fmt function.

The function returns a RuntimeError if the Object’s type does not support the “debug” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn display( self, origin: Origin, lhs: Origin, formatter: &mut Formatter<'_>, ) -> RuntimeResult<()>

Calls a Display operator on this Object to format the underlying Cell’s data for display purposes.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the operand (this Object).

The formatter parameter specifies the Rust Formatter that will be passed to the Display::fmt function.

The function returns a RuntimeError if the Object’s type does not support the “display” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn partial_eq( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<bool>

Calls an equality operator (lhs == rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the equality operator or if the operator’s implementation returns a RuntimeError.

Note that in the current model of script interpretation, partial equality (PartialEq) also serves the purpose of full equality (Eq).

Source

pub fn partial_ord( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<Option<Ordering>>

Calls a partial ordering operator (lhs >= rhs, lhs < rhs, etc.) on this Object as the left-hand side (LHS) of the operation.

Returns the result of the objects’ comparison via PartialOrd.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the partial ordering operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn ord( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<Ordering>

Calls a full ordering operator (lhs >= rhs, lhs < rhs, etc.) on this Object as the left-hand side (LHS) of the operation.

Returns the result of the objects’ comparison via Ord.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the full ordering operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn ord_fallback( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<Ordering>

Similar to Object::ord, but if the Object’s type does not support the full ordering operator, it falls back to Object::partial_ord. If the partial ordering returns None, this function returns a RuntimeError indicating that the “ord” operator is not supported.

Source

pub fn hash( self, origin: Origin, lhs: Origin, hasher: &mut impl Hasher, ) -> RuntimeResult<()>

Feeds this Object’s content into the specified hasher.

The origin parameter specifies the Rust or Script source code range that spans the hashing operator.

The lhs parameter specifies the Rust or Script source code range that spans the hashing operand (this Object).

The function returns a RuntimeError if the Object’s type does not support the “hash” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn invoke( self, origin: Origin, lhs: Origin, arguments: &mut [Arg], ) -> RuntimeResult<Cell>

Calls an invocation operator (func(arg1, arg2, arg3)) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “invoke” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn bind(self, origin: Origin, lhs: Origin, rhs: Arg) -> RuntimeResult<()>

Sets the invocation context of the object.

The meaning of the binding operator is type-dependent, but usually it sets the context in which this object will be invoked.

For example, in the foo.bar() code, the interpreter would first bind “bar” to “foo,” assuming “foo” is the receiver-parameter of the “bar” function. Then, the interpreter would call the invocation operator on the bound “bar” Object.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the binding context (the source code range and the data of the context Cell).

The function returns a RuntimeError if the Object’s type does not support the “binding” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn add(self, origin: Origin, lhs: Origin, rhs: Arg) -> RuntimeResult<Cell>

Calls an addition operator (lhs + rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “add” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn add_assign( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Calls an addition-assignment operator (lhs += rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “add-assign” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn add_assign_fallback( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Similar to Object::add_assign, but if the Object’s type does not support the “add-assign” operator, it falls back to Object::add, and then to Object::assign.

If the fallback operators are also not supported, this function returns a RuntimeError indicating that the “add-assign” operator is not supported.

Source

pub fn sub(self, origin: Origin, lhs: Origin, rhs: Arg) -> RuntimeResult<Cell>

Calls a subtraction operator (lhs - rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “sub” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn sub_assign( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Calls a subtraction-assignment operator (lhs -= rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “sub-assign” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn sub_assign_fallback( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Similar to Object::sub_assign, but if the Object’s type does not support the “sub-assign” operator, it falls back to Object::sub, and then to Object::assign.

If the fallback operators are also not supported, this function returns a RuntimeError indicating that the “sub-assign” operator is not supported.

Source

pub fn mul(self, origin: Origin, lhs: Origin, rhs: Arg) -> RuntimeResult<Cell>

Calls a multiplication operator (lhs * rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “mul” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn mul_assign( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Calls a multiplication-assignment operator (lhs *= rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “mul-assign” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn mul_assign_fallback( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Similar to Object::mul_assign, but if the Object’s type does not support the “mul-assign” operator, it falls back to Object::mul, and then to Object::assign.

If the fallback operators are also not supported, this function returns a RuntimeError indicating that the “mul-assign” operator is not supported.

Source

pub fn div(self, origin: Origin, lhs: Origin, rhs: Arg) -> RuntimeResult<Cell>

Calls a division operator (lhs / rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “div” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn div_assign( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Calls a division-assignment operator (lhs /= rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “div-assign” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn div_assign_fallback( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Similar to Object::div_assign, but if the Object’s type does not support the “div-assign” operator, it falls back to Object::div, and then to Object::assign.

If the fallback operators are also not supported, this function returns a RuntimeError indicating that the “div-assign” operator is not supported.

Source

pub fn and(self, origin: Origin, lhs: Origin, rhs: Arg) -> RuntimeResult<Cell>

Calls a logical conjunction operator (lhs && rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “and” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn or(self, origin: Origin, lhs: Origin, rhs: Arg) -> RuntimeResult<Cell>

Calls a logical disjunction operator (lhs || rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “or” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn not(self, origin: Origin, rhs: Origin) -> RuntimeResult<Cell>

Calls a logical negation operator (!rhs) on this Object.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The rhs parameter specifies the Rust or Script source code range that spans the operand (this Object).

The function returns a RuntimeError if the Object’s type does not support the “not” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn neg(self, origin: Origin, rhs: Origin) -> RuntimeResult<Cell>

Calls a numeric negation operator (-rhs) on this Object.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The rhs parameter specifies the Rust or Script source code range that spans the operand (this Object).

The function returns a RuntimeError if the Object’s type does not support the “neg” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn bit_and( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<Cell>

Calls a bitwise conjunction operator (lhs & rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “bit-and” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn bit_and_assign( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Calls a bitwise conjunction and assignment operator (lhs &= rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “bit-and-assign” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn bit_and_assign_fallback( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Similar to Object::bit_and_assign, but if the Object’s type does not support the “bit-and-assign” operator, it falls back to Object::bit_and, and then to Object::assign.

If the fallback operators are also not supported, this function returns a RuntimeError indicating that the “bit-and-assign” operator is not supported.

Source

pub fn bit_or( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<Cell>

Calls a bitwise disjunction operator (lhs | rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “bit-or” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn bit_or_assign( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Calls a bitwise disjunction and assignment operator (lhs |= rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “bit-or-assign” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn bit_or_assign_fallback( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Similar to Object::bit_or_assign, but if the Object’s type does not support the “bit-or-assign” operator, it falls back to Object::bit_or, and then to Object::assign.

If the fallback operators are also not supported, this function returns a RuntimeError indicating that the “bit-or-assign” operator is not supported.

Source

pub fn bit_xor( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<Cell>

Calls a bitwise exclusive disjunction operator (lhs ^ rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “bit-xor” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn bit_xor_assign( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Calls a bitwise exclusive disjunction and assignment operator (lhs ^= rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “bit-xor-assign” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn bit_xor_assign_fallback( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Similar to Object::bit_xor_assign, but if the Object’s type does not support the “bit-xor-assign” operator, it falls back to Object::bit_xor, and then to Object::assign.

If the fallback operators are also not supported, this function returns a RuntimeError indicating that the “bit-xor-assign” operator is not supported.

Source

pub fn shl(self, origin: Origin, lhs: Origin, rhs: Arg) -> RuntimeResult<Cell>

Calls a bitwise left shift operator (lhs << rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “shl” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn shl_assign( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Calls a bitwise left shift and assignment operator (lhs <<= rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “shl-assign” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn shl_assign_fallback( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Similar to Object::shl_assign, but if the Object’s type does not support the “shl-assign” operator, it falls back to Object::shl, and then to Object::assign.

If the fallback operators are also not supported, this function returns a RuntimeError indicating that the “shl-assign” operator is not supported.

Source

pub fn shr(self, origin: Origin, lhs: Origin, rhs: Arg) -> RuntimeResult<Cell>

Calls a bitwise right shift operator (lhs >> rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “shr” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn shr_assign( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Calls a bitwise right shift and assignment operator (lhs >>= rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “shr-assign” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn shr_assign_fallback( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Same as Object::shr_assign, but if the Object’s type does not support an “shr-assign” operator, falls back to the Object::shr, and then to the Object::assign.

If the falling-back operators are not supported as well, this function returns RuntimeError indicating that the “shr-assign” operator is not supported.

Source

pub fn rem(self, origin: Origin, lhs: Origin, rhs: Arg) -> RuntimeResult<Cell>

Calls a remainder of division operator (lhs % rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “rem” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn rem_assign( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Calls a remainder of division and assignment operator (lhs %= rhs) on this Object as the left-hand side (LHS) of the operation.

The origin parameter specifies the Rust or Script source code range that spans the operator.

The lhs parameter specifies the Rust or Script source code range that spans the left-hand operand (this Object).

The rhs parameter specifies the right-hand side (RHS) of the operation, including the source code range and the data of the RHS.

The function returns a RuntimeError if the Object’s type does not support the “rem-assign” operator or if the operator’s implementation returns a RuntimeError.

Source

pub fn rem_assign_fallback( self, origin: Origin, lhs: Origin, rhs: Arg, ) -> RuntimeResult<()>

Similar to Object::rem_assign, but if the Object’s type does not support the “rem-assign” operator, it falls back to Object::rem, and then to Object::assign.

If the fallback operators are also not supported, this function returns a RuntimeError indicating that the “rem-assign” operator is not supported.

Source

pub fn cell(&self) -> &Cell

Returns a reference to the underlying Cell of this Object.

Source

pub fn ty(&self) -> &'static TypeMeta

Returns the metadata of the Object’s type (similar to Cell::ty).

Source

pub fn prototype(&self) -> &'static Prototype

Returns a Prototype of the Object’s type, which describes the operations available for this type.

Source

pub fn into_cell(self) -> Cell

Converts this object back into the underlying Cell.

This operation is the reverse of Cell::into_object.

Auto Trait Implementations§

§

impl Freeze for Object

§

impl !RefUnwindSafe for Object

§

impl Send for Object

§

impl Sync for Object

§

impl Unpin for Object

§

impl !UnwindSafe for Object

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.