Skip to main content

UserdataMarker

Struct UserdataMarker 

Source
pub struct UserdataMarker<'a> { /* private fields */ }
Expand description

Public facade over the GC mark accumulator passed to LuaUserdata::trace.

Wraps the crate-internal Marker (private GC primitive in runtime::heap) so embedders never see the gray-stack / weak-table internals. Holds a mutable borrow of the underlying marker for the duration of a single trace call. Constructed only by the collector via the crate-internal __new_internal constructor; embedders cannot synthesize one outside a trace call.

§Trace-method contract

Inside LuaUserdata::trace the embedder may only:

The embedder must not allocate new GC objects, reenter the Vm, take locks, or perform I/O. The trace call runs synchronously inside the collector’s mark phase and must return in bounded wall time.

Implementations§

Source§

impl<'a> UserdataMarker<'a>

Source

pub fn mark<T>(&mut self, g: Gc<T>) -> bool

Mark a Gc-managed object as reachable. Returns true on the first visit (white → gray transition). Idempotent on later visits within the same cycle.

Source

pub fn mark_value(&mut self, v: Value) -> bool

Convenience: mark every Gc-managed object referenced by a Value. No-op for primitive variants (Int, Float, Bool, Nil, LightUserdata).

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for UserdataMarker<'a>

§

impl<'a> !Send for UserdataMarker<'a>

§

impl<'a> !Sync for UserdataMarker<'a>

§

impl<'a> !UnwindSafe for UserdataMarker<'a>

§

impl<'a> Freeze for UserdataMarker<'a>

§

impl<'a> Unpin for UserdataMarker<'a>

§

impl<'a> UnsafeUnpin for UserdataMarker<'a>

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.