docs

You are reading the docs for v0.1.0. Nabi 0.1.0 is no longer supported. Latest release: v0.1.3 →

bare

raw pointers, transmute, raw allocation, pinning and volatile access, over the runtime's extern "nabi" symbols only. Never in the prelude: code that needs it says use bare::... The named casts live at the tier root.

Modules

  • alloc raw allocation outside the GC.
  • ffi C's types (types, also in the prelude), errno (errno), Nabi values C holds (handle), NUL-terminated C strings (wide: wchar_t ones), loading shared libraries (library); wit is what the WIT bindings run on; objc, Objective-C objects, exists only on Apple targets.
  • gc the collector's controls, and keeping GC objects in place for raw pointers.
  • mem raw memory operations, Pod and bit casts.
  • ptr raw pointers.
  • volatile accesses the optimizer keeps exactly as written: MMIO, signal flags, DMA buffers.

Re-exports

mem::{Pod, reinterpret, transmute_unchecked}Source

pub use mem::{Pod, reinterpret, transmute_unchecked}
  • Pod Plain old data: every bit pattern of the type is a valid value, its layout is fixed and it has no Drop.
  • reinterpret The bits of a as a B; both are Pod and the same size (a size mismatch panics).
  • transmute_unchecked The bits of a as a B, unchecked: validity, size and the GC references inside are the caller's problem.

ptr::{align_cast, align_cast_unchecked, const_cast, ptr_cast}Source

pub use ptr::{align_cast, align_cast_unchecked, const_cast, ptr_cast}
  • align_cast p as a Ptr<T> when its address suits T's alignment.
  • align_cast_unchecked p as a Ptr<T> with no alignment check, not even in debug builds.
  • const_cast Drop the const: writing through the result is the caller's responsibility.
  • ptr_cast The same address as a pointer to U (ptr_cast::<U>(p); alignment is the caller's problem).