logos.mem.manually_drop

Module mem · package logos-mem

Types

structAlignment

struct Alignment

Represents a power-of-2 alignment, in bytes.

Fields

bytes: u64

Alignment in bytes; a nonzero power of 2 when constructed via alignment_new.

Methods

fn as_u64(self: &Alignment) -> u64

Returns the alignment in bytes.

fn log2(self: &Alignment) -> u32

Returns log2 of the alignment (trailing-zero count of bytes).

structDropGuard

struct DropGuard

Runs the closure f at scope-exit (drop) unless defused via disarm.

Implements: Drop

Fields

armed: bool

Whether the closure fires on drop; cleared by disarm.

f: F

Cleanup closure; called exactly once at drop while armed.

structManuallyDrop

struct ManuallyDrop

Wraps a T and suppresses its destructor at scope-exit. Destroy or recover the value explicitly via manually_drop_drop / manually_drop_into_inner.

Fields

value: T

Wrapped value; no drop glue runs for it automatically.

structMaybeDangling

struct MaybeDangling

Marks the inner T as exempt from dangling-reference checks. Informational for now: borrowck does not yet honour the marker.

Fields

value: T

Wrapped, possibly-dangling value.

Functions

fnalignment_new

fn alignment_new(n: u64) -> Option

Returns Some(Alignment) if n is a power of 2 > 0, else None.

fnalignment_new_unchecked

fn alignment_new_unchecked(n: u64) -> Alignment

Creates an Alignment without the power-of-2 check (Rust’s Alignment::new_unchecked). Unsafe: caller must guarantee n is a nonzero power of 2.

fndrop_guard_disarm_into

fn drop_guard_disarm_into(g: DropGuard<F>) -> F

Consumes the guard, returning the closure f without running it. Extracting f by value suppresses the guard’s Drop.

fndrop_guard_new

fn drop_guard_new(f: F) -> DropGuard<F>

Creates an armed DropGuard that runs f on drop.

fnmanually_drop_drop

fn manually_drop_drop(md: &mut ManuallyDrop<T>) -> void

Runs the inner value’s Drop in place, without consuming the wrapper. Mirrors Rust’s unsafe fn ManuallyDrop::drop (ptr::drop_in_place on the inner value). Unsafe: after this the inner value is logically gone — do not read it or drop it again.

fnmanually_drop_into_inner

fn manually_drop_into_inner(md: ManuallyDrop<T>) -> T

Moves the inner value out of the wrapper, consuming it. The returned value behaves normally: its Drop, if any, fires at the caller’s scope-exit.

fnmanually_drop_new

fn manually_drop_new(v: T) -> ManuallyDrop<T>

Wraps v in ManuallyDrop, suppressing its destructor at scope-exit.

fnmaybe_dangling_into_inner

fn maybe_dangling_into_inner(m: MaybeDangling<T>) -> T

Moves the inner value out, consuming the wrapper.

fnmaybe_dangling_new

fn maybe_dangling_new(v: T) -> MaybeDangling<T>

Wraps v in MaybeDangling.