Skip to main content

Object

Struct Object 

Source
pub struct Object<T: 'static> { /* private fields */ }
Expand description

A live, type-checked handle to a Rust object in one VM and decision epoch.

Clones share the same object without cloning T. Payload references exist only during method callbacks. Reset invalidates every handle and releases the VM’s payload ownership even if an old Rust handle is still retained.

Implementations§

Source§

impl<T: 'static> Object<T>

Source

pub fn as_value(&self) -> Value

Clones the underlying live value for globals, tables, and callback results.

Source

pub fn decision_epoch(&self) -> u64

Returns the decision epoch in which this object was retained.

Source

pub fn call_method<A: IntoRustiaMulti, R: FromRustiaMulti>( &self, lua: &mut Rustia, name: &str, args: A, ) -> Result<R>

Calls a method with Rust arguments and copies all returned values into Rust.

The receiver is supplied automatically. () passes no arguments. Use call_method_values for object results or other values that cannot be copied into crate::OwnedValue.

Source

pub fn call_method_values( &self, lua: &mut Rustia, name: &str, args: &[Value], ) -> Result<Vec<Value>>

Calls a method with live arguments and keeps every result live.

Source

pub fn call_method_in<H: HostSchema, A: IntoRustiaMulti, R: FromRustiaMulti>( &self, invocation: &mut Invocation<'_, H>, name: &str, args: A, ) -> Result<R>

Calls a method within a typed invocation’s shared budget and record journal.

A conversion or execution error discards this call’s staged records. Guest writes and external application changes remain.

Source

pub fn call_method_values_in<H: HostSchema>( &self, invocation: &mut Invocation<'_, H>, name: &str, args: &[Value], ) -> Result<Vec<Value>>

Calls a method with live values inside a typed invocation.

Trait Implementations§

Source§

impl<T: 'static> Clone for Object<T>

Source§

fn clone(&self) -> Self

Returns a duplicate 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<T: 'static> Debug for Object<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Object<T>

§

impl<T> !RefUnwindSafe for Object<T>

§

impl<T> !Send for Object<T>

§

impl<T> !Sync for Object<T>

§

impl<T> Unpin for Object<T>

§

impl<T> UnsafeUnpin for Object<T>

§

impl<T> !UnwindSafe for Object<T>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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

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.
Source§

impl<T> FromHostArgument for T
where T: Argument,

Source§

impl<T> IntoHostReturn for T
where T: Return,

Source§

impl<T> IntoHostValue for T
where T: Value,