pub struct LuaStringImpl { /* private fields */ }Expand description
A Lua string: an immutable, reference-counted byte sequence. Corresponds
to C’s TString.
Short strings (<= MAX_SHORT_LEN = 40 bytes) are interned in the
StringPool on GlobalState; two short strings with the same bytes
are guaranteed to be the same GcRef (pointer equality via Rc::ptr_eq).
In practice the only LuaStringImpl ever created is the bootstrap OOM
message — see the module doc.
Long strings are heap-allocated independently and never interned. hash
is set once at construction in [create_str_obj], not computed lazily.
Implementations§
Source§impl LuaStringImpl
impl LuaStringImpl
Sourcepub fn is_reserved_word(&self) -> bool
pub fn is_reserved_word(&self) -> bool
Returns true if this short string is a Lua reserved word.
Sourcepub fn is_white(&self) -> bool
pub fn is_white(&self) -> bool
GC color predicate. LuaStringImpl values are never registered with
the tracing collector (see the module doc), so this always returns
false.
Sourcepub fn flip_white(&self)
pub fn flip_white(&self)
Flip GC color from white to the current non-white (resurrect a dead
object). No-op; see Self::is_white.
Trait Implementations§
impl Eq for LuaStringImpl
Source§impl PartialEq for LuaStringImpl
impl PartialEq for LuaStringImpl
Source§impl Trace for LuaStringImpl
The byte buffer is a Rust Rc<[u8]> (not GC-managed); no fields to mark.
impl Trace for LuaStringImpl
The byte buffer is a Rust Rc<[u8]> (not GC-managed); no fields to mark.
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
Heap::type_name_count). Collector behavior must not branch on
this. The default covers container blanket impls, which are never
GC-boxed directly; concrete runtime types override it with
std::any::type_name::<Self>().