Skip to main content

Crate maybe_dangling

Crate maybe_dangling 

Source
Expand description

§::maybe-dangling

ManuallyDrop<T> and MaybeDangling<T> semantics in stable Rust as per https://github.com/rust-lang/rfcs/pull/3336

Repository Latest version Documentation MSRV License CI no_std compatible

This crates offers two types, ManuallyDrop<T>, and MaybeDangling<T>, which do not carry aliasing/dereferenceable-ity properties w.r.t. the T they each contain, which means they are allowed to:

  1. have some expired value inside of them, such as T = &'expired …,
  2. be fed to a function that does not inspect its value (such as ::core::mem::forget()),
  3. exhibit well-defined behavior (no UB!).

§References

Macros§

drop_in_place
Safe API around MaybeDangling::drop_in_place(), which performs the mandatory ::core::mem::forget() on the given var.

Structs§

MaybeDangling
Like crate::ManuallyDrop but for having drop glue. This wrapper is 0-cost.

Type Aliases§

ManuallyDropDeprecated
Ever since Rust 1.96.0, and this library’s version 0.1.3…, ManuallyDrop is a mere re-export of ::core::mem::ManuallyDrop, as the latter has started featuring the desired crate::MaybeDangling semantics inside of it.