Skip to main content

Closure

Struct Closure 

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

Non-owning identity of a VM closure record.

§Safety model for unsafe methods

The closure and referenced environment, proto, upvalues, and GC objects must remain live in the same VM. The native/Luau variant and every index must match the allocated closure layout.

Implementations§

Source§

impl Closure

Source

pub const unsafe fn from_raw(raw: NonNull<RawClosure>) -> Self

Source

pub fn size_native_closure(n: usize) -> usize

Source

pub fn size_lua_closure(n: usize) -> usize

Source

pub unsafe fn size(&self) -> usize

sizeclosure

Source

pub unsafe fn is_native(&self) -> bool

Source

pub unsafe fn is_lua(&self) -> bool

Source

pub unsafe fn proto(&self) -> Option<Proto>

Source

pub unsafe fn env(&self) -> Table

Source

pub unsafe fn gc_list(&self) -> Option<GcObject>

Source

pub unsafe fn set_gc_list(&self, gc_list: Option<GcObject>)

Source

pub unsafe fn set_env(&self, env: Table)

Source

pub unsafe fn native_data(&self) -> RawNativeClosure

Source

pub unsafe fn native_data_ptr(&self) -> *mut RawNativeClosure

Source

pub unsafe fn set_native_data(&self, data: RawNativeClosure)

Source

pub unsafe fn native_debug_name(&self) -> Option<LuaString>

Source

pub unsafe fn lua_data(&self) -> RawLuaClosure

Source

pub unsafe fn lua_data_ptr(&self) -> *mut RawLuaClosure

Source

pub unsafe fn set_lua_proto(&self, proto: Proto)

Source

pub unsafe fn native_upvalue(&self, index: usize) -> TValue

Source

pub unsafe fn native_upvalues(&self) -> TValueCursor

Source

pub unsafe fn lua_upvalue_ref(&self, index: usize) -> TValue

Source

pub unsafe fn lua_upvalue_refs(&self) -> TValueCursor

Trait Implementations§

Source§

impl AsRef<Closure> for Closure

Source§

fn as_ref(&self) -> &Closure

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Closure

Source§

fn clone(&self) -> Closure

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Closure

Source§

impl Eq for Closure

Source§

impl From<Closure> for GcObject

Source§

fn from(value: Closure) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Closure

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl RawHandle for Closure

Source§

type Raw = RawClosure

Raw VM record addressed by this handle.
Source§

fn as_ptr(&self) -> *mut Self::Raw

Returns the record address without dereferencing it.
Source§

impl StructuralPartialEq for Closure

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