Unsafe operations
bump_box_refcount
- Force-increment the reference count on a shared boxcopy_lifetime
- Transforms lifetime of the second pointer to match the first.copy_lifetime_vec
- Transforms lifetime of the second pointer to match the first.forget
- Move a thing into the voidreinterpret_cast
- Casts the value at src
to Utransmute
- Transform a value of one type into a value of another typetransmute_immut
- Coerce a mutable reference to be immutable.transmute_immut_unsafe
- Coerce an immutable reference to be mutable.transmute_mut
- Coerce an immutable reference to be mutable.transmute_mut_region
- Coerce a borrowed mutable pointer to have an arbitrary associated region.transmute_mut_unsafe
- Coerce an immutable reference to be mutable.transmute_region
- Coerce a borrowed pointer to have an arbitrary associated region.cast::rusti
bump_box_refcount
fn bump_box_refcount<T>(t: @T)
Force-increment the reference count on a shared box. If used carelessly, this can leak the box. Use this in conjunction with transmute and/or reinterpret_cast when such calls would otherwise scramble a box's reference count
copy_lifetime
fn copy_lifetime<S, T>(_ptr: &a/S, ptr: &T) -> &a/T
Transforms lifetime of the second pointer to match the first.
copy_lifetime_vec
fn copy_lifetime_vec<S, T>(_ptr: &a/[S], ptr: &T) -> &a/T
Transforms lifetime of the second pointer to match the first.
forget
fn forget<T>(thing: T)
Move a thing into the void
The forget function will take ownership of the provided value but neglect to run any required cleanup or memory-management operations on it. This can be used for various acts of magick, particularly when using reinterpret_cast on pointer types.
reinterpret_cast
fn reinterpret_cast<T, U>(src: &T) -> U
Casts the value at src
to U. The two types must have the same length.
transmute
fn transmute<L, G>(thing: L) -> G
Transform a value of one type into a value of another type. Both types must have the same size and alignment.
assert transmute("L") == ~[76u8, 0u8];
transmute_immut
fn transmute_immut<T>(ptr: &a/mut T) -> &a/T
Coerce a mutable reference to be immutable.
transmute_immut_unsafe
fn transmute_immut_unsafe<T>(ptr: *const T) -> *T
Coerce an immutable reference to be mutable.
transmute_mut
fn transmute_mut<T>(ptr: &a/T) -> &a/mut T
Coerce an immutable reference to be mutable.
transmute_mut_region
fn transmute_mut_region<T>(ptr: &a/mut T) -> &b/mut T
Coerce a borrowed mutable pointer to have an arbitrary associated region.
transmute_mut_unsafe
fn transmute_mut_unsafe<T>(ptr: *const T) -> *mut T
Coerce an immutable reference to be mutable.
transmute_region
fn transmute_region<T>(ptr: &a/T) -> &b/T
Coerce a borrowed pointer to have an arbitrary associated region.