pub struct TString { /* private fields */ }Implementations§
Source§impl TString
impl TString
Sourcepub unsafe fn fix(&self)
pub unsafe fn fix(&self)
luaS_fix
§Safety
The string must still belong to a live VM, and the caller must ensure that no concurrent or reentrant collector operation accesses its mark bits while they are updated.
Sourcepub const unsafe fn from_raw(raw: NonNull<RawTString>) -> Self
pub const unsafe fn from_raw(raw: NonNull<RawTString>) -> Self
Constructs a non-owning string handle from a raw VM record.
§Safety
raw must address a live RawTString owned by the VM in which the
handle will be used. The handle does not root the string or extend its
lifetime.
Sourcepub unsafe fn from_ref(raw: &RawTString) -> Self
pub unsafe fn from_ref(raw: &RawTString) -> Self
Constructs a non-owning string handle from a VM string record.
§Safety
raw must be a live, VM-owned string record. The returned handle may
not outlive that record and does not keep it reachable from the GC.
pub fn atom(&self) -> i16
pub fn set_atom(&self, atom: i16)
pub const fn size_string(len: usize) -> usize
pub fn data_ptr(&self) -> *const u8
Sourcepub unsafe fn data_mut_ptr(&self) -> *mut u8
pub unsafe fn data_mut_ptr(&self) -> *mut u8
Returns the address of the string’s inline byte storage.
§Safety
The string must be live. Mutating interned string bytes can invalidate hashes and table invariants, so writes are only valid during the VM’s owned string-construction protocol before the string is published.
Sourcepub unsafe fn as_bytes(&self) -> &[u8] ⓘ
pub unsafe fn as_bytes(&self) -> &[u8] ⓘ
Borrows the string’s bytes for the duration of this handle borrow.
§Safety
The string must remain live and its storage must not be freed for the returned borrow. Because this handle does not root the string, the caller must also prevent VM transitions that could collect it.