logos.lang.ptr
Module lang · package logos-lang
Types
structNonNull
struct NonNull
A *mut T that is guaranteed non-null.
Type-level “never null” invariant used inside smart pointers (Box, Rc,
Arc, Vec). Construct via new (checked) or new_unchecked (unsafe).
Fields
ptr: *mut T
Functions
fnaddr_eq
fn addr_eq(a: *const T, b: *const U) -> bool
Returns true if a and b have the same address, across pointee types.
fncopy
fn copy(src: *const T, dst: *mut T, count: i64) -> void
Copies count elements from src to dst; the regions may overlap.
memmove semantics — the copy direction is chosen to handle overlap correctly.
fncopy_nonoverlapping
fn copy_nonoverlapping(src: *const T, dst: *mut T, count: i64) -> void
Copies count elements from src to dst; the regions must not overlap.
Cheaper than copy — no overlap direction check. Overlapping regions are UB.
fndrop_in_place
fn drop_in_place(p: *mut T) -> void
Executes the pointee’s Drop in place, leaving the storage untouched.
Runs only a user impl Drop; fields are NOT recursively dropped (Logos
explicit-Drop convention). The storage must not be read or re-dropped after.
fneq
fn eq(a: *const T, b: *const T) -> bool
Returns true if a and b have the same address (pointee values ignored).
fnnull
fn null() -> *const T
Returns the null *const T.
Safe to call; reading or writing through the returned pointer is UB.
fnnull_mut
fn null_mut() -> *mut T
Returns the null *mut T.
Safe to call; reading or writing through the returned pointer is UB.
fnread
fn read(src: *const T) -> T
Reads and returns the T at src, taking ownership (bit-for-bit copy).
src must point at an initialized T; for non-Copy T the source
location must not be read again afterwards (by-value move semantics).
fnread_unaligned
fn read_unaligned(src: *const T) -> T
Reads the T at src without an alignment requirement.
Plain load today; x86-64 tolerates unaligned scalar access (see section note).
fnread_volatile
fn read_volatile(src: *const T) -> T
Reads the T at src with volatile semantics.
Currently a plain load — the backend has no volatile op yet (see section note).
fnreplace
fn replace(dst: *mut T, src: T) -> T
Replaces the value at dst with src and returns the old value.
fnswap
fn swap(x: *mut T, y: *mut T) -> void
Swaps the values at x and y.
fnwrite
fn write(dst: *mut T, src: T) -> void
Writes src to dst without reading or dropping the previous pointee.
Safe to use on uninitialized destinations (MaybeUninit / collection internals).
fnwrite_unaligned
fn write_unaligned(dst: *mut T, src: T) -> void
Writes src to dst without an alignment requirement.
Plain store today; x86-64 tolerates unaligned scalar access (see section note).
fnwrite_volatile
fn write_volatile(dst: *mut T, src: T) -> void
Writes src to dst with volatile semantics.
Currently a plain store — the backend has no volatile op yet (see section note).