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§
- PodCast
Error - The things that can go wrong when casting between
Pod
data forms.
Traits§
- AnyBit
Pattern - 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]
). - Checked
BitPattern - A marker trait that allows types that have some invalid bit patterns to be
used in places that otherwise require
AnyBitPattern
orPod
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:
- Into
Bytes - 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”.
- PodIn
Option - Trait for types which are Pod when wrapped in Option.
- Transparent
Wrapper - A trait which indicates that a type is a
#[repr(transparent)]
wrapper around theInner
value. - Zeroable
- Trait for types that can be safely created with
zeroed
. - Zeroable
InOption - 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
intoB
- 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 (seeZeroable
). - 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 thePod
bound. - pod_
align_ to_ mut - As
align_to_mut
, but safe because of thePod
bound. - pod_
read_ unaligned - Reads the slice into a
T
value. - try_
cast - Try to cast
A
intoB
. - 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 (seeZeroable
).
Derive Macros§
- AnyBit
Pattern - Derive the
AnyBitPattern
trait for a struct - Checked
BitPattern - 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 - Transparent
Wrapper - Derive the
TransparentWrapper
trait for a struct - Zeroable
- Derive the
Zeroable
trait for a type.