Module own

Module own 

Source
Expand description

Own namespace of the module.

Modules§

checked
Checked versions of the casting functions exposed in crate root that support CheckedBitPattern types.

Macros§

offset_of
Find the offset in bytes of the given $field of $Type. Requires an already initialized $instance value to work with.

Enums§

PodCastError
The things that can go wrong when casting between Pod data forms.

Traits§

AnyBitPattern
Marker trait for “plain old data” types that are valid for any bit pattern.
AsBytes
Trait for borrowing data as byte slices. This trait abstracts the conversion of types that implement Pod (or collections thereof) into their raw byte representation as a slice (&[u8]).
CheckedBitPattern
A marker trait that allows types that have some invalid bit patterns to be used in places that otherwise require AnyBitPattern or Pod types by performing a runtime check on a perticular set of bits. This is particularly useful for types like fieldless (‘C-style’) enums, char, bool, and structs containing them.
Contiguous
A trait indicating that:
IntoBytes
Trait for consuming data into an owned byte vector. This trait is for types that can be meaningfully converted into a Vec< u8 > by consuming the original value.
NoUninit
Marker trait for “plain old data” types with no uninit (or padding) bytes.
Pod
Marker trait for “plain old data”.
PodInOption
Trait for types which are Pod when wrapped in Option.
TransparentWrapper
A trait which indicates that a type is a #[repr(transparent)] wrapper around the Inner value.
Zeroable
Trait for types that can be safely created with zeroed.
ZeroableInOption
Trait for types which are Zeroable when wrapped in Option.

Functions§

bytes_of
Re-interprets &T as &[u8].
bytes_of_mut
Re-interprets &mut T as &mut [u8].
cast
Cast A into B
cast_mut
Cast &mut A into &mut B.
cast_ref
Cast &A into &B.
cast_slice
Cast &[A] into &[B].
cast_slice_mut
Cast &mut [A] into &mut [B].
fill_zeroes
Fill all bytes of slice with zeroes (see Zeroable).
from_bytes
Re-interprets &[u8] as &T.
from_bytes_mut
Re-interprets &mut [u8] as &mut T.
pod_align_to
As align_to, but safe because of the Pod bound.
pod_align_to_mut
As align_to_mut, but safe because of the Pod bound.
pod_read_unaligned
Reads the slice into a T value.
try_cast
Try to cast A into B.
try_cast_mut
Try to convert a &mut A into &mut B.
try_cast_ref
Try to convert a &A into &B.
try_cast_slice
Try to convert &[A] into &[B] (possibly with a change in length).
try_cast_slice_mut
Try to convert &mut [A] into &mut [B] (possibly with a change in length).
try_from_bytes
Re-interprets &[u8] as &T.
try_from_bytes_mut
Re-interprets &mut [u8] as &mut T.
try_pod_read_unaligned
Reads from the bytes as if they were a T.
write_zeroes
Fill all bytes of target with zeroes (see Zeroable).

Derive Macros§

AnyBitPattern
Derive the AnyBitPattern trait for a struct
CheckedBitPattern
Derive the CheckedBitPattern trait for a struct or enum.
Contiguous
Derive the Contiguous trait for an enum
NoUninit
Derive the NoUninit trait for a struct or enum
Pod
Derive the Pod trait for a struct
TransparentWrapper
Derive the TransparentWrapper trait for a struct
Zeroable
Derive the Zeroable trait for a type.