Skip to main content

CallInfoFrame

Struct CallInfoFrame 

Source
pub struct CallInfoFrame {
    pub savedpc: u32,
    pub nextraargs: i32,
    pub k: Option<LuaKFunction>,
    pub old_errfunc: isize,
    pub ctx: isize,
}
Expand description

Payload of CallInfo.u.

C 5.4 declares this as an anonymous union with a Lua-frame member (l) and a C-frame member (c); which member is live is implied by the CIST_C callstatus bit. T2-C2 flattened the previous 2-variant Rust enum into this branch-free struct: all fields are always present, so the hot accessors (saved_pc, set_saved_pc, nextra_args) are plain field reads with no discriminant test. The C-frame fields (k, old_errfunc, ctx) are only meaningful on C frames; the Lua-frame fields (savedpc, nextraargs) only on Lua frames. Accessors carry debug_assert!s on the frame kind that replace the old enum’s wrong-variant panic tripwire at zero release cost. The trap flag that used to live in the Lua variant now lives in callstatus bit CIST_TRAP.

Layout: u32 + i32 + Option<fn> + isize + isize = 32 B (8-byte aligned), identical to the previous enum payload, so CallInfo stays 72 B.

Fields§

§savedpc: u32

Lua-frame: index of the next bytecode instruction. C: u.l.savedpc. types.tsv: CallInfo.u.l.savedpc → u32

§nextraargs: i32

Lua-frame: count of extra varargs collected at entry. C: u.l.nextraargs. types.tsv: CallInfo.u.l.nextraargs → i32

§k: Option<LuaKFunction>

C-frame: continuation function for a yieldable C call. C: u.c.k. types.tsv: CallInfo.u.c.k → Option<lua_KFunction>

§old_errfunc: isize

C-frame: saved errfunc to restore on pcall recovery. C: u.c.old_errfunc. types.tsv: CallInfo.u.c.old_errfunc → isize

§ctx: isize

C-frame: continuation context. C: u.c.ctx. types.tsv: CallInfo.u.c.ctx → isize

Implementations§

Source§

impl CallInfoFrame

Source

pub fn c_default() -> Self

Default C-call frame: no continuation, zero context. The Lua-frame fields are benignly zeroed so any latent read on a misclassified frame reads the same value the old C variant produced.

Source

pub fn lua_default() -> Self

Default Lua-call frame: pc=0, no extra args. The C-frame fields are benignly zeroed to exactly the values c_default produced, so a Lua frame that is later reclassified or read as a C frame sees identical defaults to the pre-flatten enum (which carried no C fields). The trap flag now lives in callstatus bit CIST_TRAP, cleared by the callstatus write in prep_call_info, not here.

Trait Implementations§

Source§

impl Clone for CallInfoFrame

Source§

fn clone(&self) -> CallInfoFrame

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 CallInfoFrame

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.