Module allocation

Source
Expand description

Stuff to boost things in the alloc crate.

  • You must enable the extern_crate_alloc feature of bytemuck or you will not be able to use this module! This is generally done by adding the feature to the dependency in Cargo.toml like so:

    bytemuck = { version = "VERSION_YOU_ARE_USING", features = ["extern_crate_alloc"]}

Structs§

BoxBytes
As Box<[u8]>, but remembers the original alignment.

Traits§

TransparentWrapperAlloc
An extension trait for TransparentWrapper and alloc types.

Functions§

box_bytes_of
Re-interprets Box<T> as BoxBytes.
cast_arc
As try_cast_arc, but unwraps for you.
cast_box
As try_cast_box, but unwraps for you.
cast_rc
As try_cast_rc, but unwraps for you.
cast_slice_arc
As try_cast_slice_arc, but unwraps for you.
cast_slice_box
As try_cast_slice_box, but unwraps for you.
cast_slice_rc
As try_cast_slice_rc, but unwraps for you.
cast_vec
As try_cast_vec, but unwraps for you.
from_box_bytes
Re-interprets BoxBytes as Box<T>.
pod_collect_to_vec
This “collects” a slice of pod data into a vec of a different pod type.
try_cast_arc
Attempts to cast the content type of a Arc.
try_cast_box
Attempts to cast the content type of a Box.
try_cast_rc
Attempts to cast the content type of a Rc.
try_cast_slice_arc
Attempts to cast the content type of a Arc<[T]>.
try_cast_slice_box
Attempts to cast the content type of a Box<[T]>.
try_cast_slice_rc
Attempts to cast the content type of a Rc<[T]>.
try_cast_vec
Attempts to cast the content type of a Vec.
try_from_box_bytes
Re-interprets BoxBytes as Box<T>.
try_zeroed_box
Allocates a Box<T> with all of the contents being zeroed out.
try_zeroed_slice_box
Allocates a Box<[T]> with all contents being zeroed out.
try_zeroed_vec
Allocates a Vec<T> of length and capacity exactly equal to length and all elements zeroed.
zeroed_box
As try_zeroed_box, but unwraps for you.
zeroed_slice_box
As try_zeroed_slice_box, but unwraps for you.
zeroed_vec
As try_zeroed_vec but unwraps for you