zerocopy

Trait FromBytes

Source
pub unsafe trait FromBytes: FromZeros {
Show 15 methods // Provided methods fn ref_from_bytes(source: &[u8]) -> Result<&Self, CastError<&[u8], Self>> where Self: KnownLayout + Immutable { ... } fn ref_from_prefix( source: &[u8], ) -> Result<(&Self, &[u8]), CastError<&[u8], Self>> where Self: KnownLayout + Immutable { ... } fn ref_from_suffix( source: &[u8], ) -> Result<(&[u8], &Self), CastError<&[u8], Self>> where Self: Immutable + KnownLayout { ... } fn mut_from_bytes( source: &mut [u8], ) -> Result<&mut Self, CastError<&mut [u8], Self>> where Self: IntoBytes + KnownLayout { ... } fn mut_from_prefix( source: &mut [u8], ) -> Result<(&mut Self, &mut [u8]), CastError<&mut [u8], Self>> where Self: IntoBytes + KnownLayout { ... } fn mut_from_suffix( source: &mut [u8], ) -> Result<(&mut [u8], &mut Self), CastError<&mut [u8], Self>> where Self: IntoBytes + KnownLayout { ... } fn ref_from_bytes_with_elems( source: &[u8], count: usize, ) -> Result<&Self, CastError<&[u8], Self>> where Self: KnownLayout<PointerMetadata = usize> + Immutable { ... } fn ref_from_prefix_with_elems( source: &[u8], count: usize, ) -> Result<(&Self, &[u8]), CastError<&[u8], Self>> where Self: KnownLayout<PointerMetadata = usize> + Immutable { ... } fn ref_from_suffix_with_elems( source: &[u8], count: usize, ) -> Result<(&[u8], &Self), CastError<&[u8], Self>> where Self: KnownLayout<PointerMetadata = usize> + Immutable { ... } fn mut_from_bytes_with_elems( source: &mut [u8], count: usize, ) -> Result<&mut Self, CastError<&mut [u8], Self>> where Self: IntoBytes + KnownLayout<PointerMetadata = usize> + Immutable { ... } fn mut_from_prefix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut Self, &mut [u8]), CastError<&mut [u8], Self>> where Self: IntoBytes + KnownLayout<PointerMetadata = usize> { ... } fn mut_from_suffix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut [u8], &mut Self), CastError<&mut [u8], Self>> where Self: IntoBytes + KnownLayout<PointerMetadata = usize> { ... } fn read_from_bytes(source: &[u8]) -> Result<Self, SizeError<&[u8], Self>> where Self: Sized { ... } fn read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), SizeError<&[u8], Self>> where Self: Sized { ... } fn read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), SizeError<&[u8], Self>> where Self: Sized { ... }
}
Expand description

Types for which any bit pattern is valid.

Any memory region of the appropriate length which contains initialized bytes can be viewed as any FromBytes type with no runtime overhead. This is useful for efficiently parsing bytes as structured data.

§Warning: Padding bytes

Note that, when a value is moved or copied, only the non-padding bytes of that value are guaranteed to be preserved. It is unsound to assume that values written to padding bytes are preserved after a move or copy. For example, the following is unsound:

use core::mem::{size_of, transmute};
use zerocopy::FromZeros;

// Assume `Foo` is a type with padding bytes.
#[derive(FromZeros, Default)]
struct Foo {
    ...
}

let mut foo: Foo = Foo::default();
FromZeros::zero(&mut foo);
// UNSOUND: Although `FromZeros::zero` writes zeros to all bytes of `foo`,
// those writes are not guaranteed to be preserved in padding bytes when
// `foo` is moved, so this may expose padding bytes as `u8`s.
let foo_bytes: [u8; size_of::<Foo>()] = unsafe { transmute(foo) };

§Implementation

Do not implement this trait yourself! Instead, use #[derive(FromBytes)]; e.g.:

#[derive(FromBytes)]
struct MyStruct {
    ...
}

#[derive(FromBytes)]
#[repr(u8)]
enum MyEnum {
    ...
}

#[derive(FromBytes, Immutable)]
union MyUnion {
    ...
}

This derive performs a sophisticated, compile-time safety analysis to determine whether a type is FromBytes.

§Safety

This section describes what is required in order for T: FromBytes, and what unsafe code may assume of such types. If you don’t plan on implementing FromBytes manually, and you don’t plan on writing unsafe code that operates on FromBytes types, then you don’t need to read this section.

If T: FromBytes, then unsafe code may assume that it is sound to produce a T whose bytes are initialized to any sequence of valid u8s (in other words, any byte value which is not uninitialized). If a type is marked as FromBytes which violates this contract, it may cause undefined behavior.

#[derive(FromBytes)] only permits types which satisfy these requirements.

Provided Methods§

Source

fn ref_from_bytes(source: &[u8]) -> Result<&Self, CastError<&[u8], Self>>
where Self: KnownLayout + Immutable,

Interprets the given source as a &Self.

This method attempts to return a reference to source interpreted as a Self. If the length of source is not a valid size of Self, or if source is not appropriately aligned, this returns Err. If Self: Unaligned, you can infallibly discard the alignment error.

Self may be a sized type, a slice, or a slice DST.

§Compile-Time Assertions

This method cannot yet be used on unsized types whose dynamically-sized component is zero-sized. Attempting to use this method on such types results in a compile-time assertion error; e.g.:

use zerocopy::*;

#[derive(FromBytes, Immutable, KnownLayout)]
#[repr(C)]
struct ZSTy {
    leading_sized: u16,
    trailing_dst: [()],
}

let _ = ZSTy::ref_from_bytes(0u16.as_bytes()); // ⚠ Compile Error!
§Examples
use zerocopy::FromBytes;

#[derive(FromBytes, KnownLayout, Immutable)]
#[repr(C)]
struct PacketHeader {
    src_port: [u8; 2],
    dst_port: [u8; 2],
    length: [u8; 2],
    checksum: [u8; 2],
}

#[derive(FromBytes, KnownLayout, Immutable)]
#[repr(C)]
struct Packet {
    header: PacketHeader,
    body: [u8],
}

// These bytes encode a `Packet`.
let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11][..];

let packet = Packet::ref_from_bytes(bytes).unwrap();

assert_eq!(packet.header.src_port, [0, 1]);
assert_eq!(packet.header.dst_port, [2, 3]);
assert_eq!(packet.header.length, [4, 5]);
assert_eq!(packet.header.checksum, [6, 7]);
assert_eq!(packet.body, [8, 9, 10, 11]);
Source

fn ref_from_prefix( source: &[u8], ) -> Result<(&Self, &[u8]), CastError<&[u8], Self>>
where Self: KnownLayout + Immutable,

Interprets the prefix of the given source as a &Self without copying.

This method computes the largest possible size of Self that can fit in the leading bytes of source, then attempts to return both a reference to those bytes interpreted as a Self, and a reference to the remaining bytes. If there are insufficient bytes, or if source is not appropriately aligned, this returns Err. If Self: Unaligned, you can infallibly discard the alignment error.

Self may be a sized type, a slice, or a slice DST.

§Compile-Time Assertions

This method cannot yet be used on unsized types whose dynamically-sized component is zero-sized. See ref_from_prefix_with_elems, which does support such types. Attempting to use this method on such types results in a compile-time assertion error; e.g.:

use zerocopy::*;

#[derive(FromBytes, Immutable, KnownLayout)]
#[repr(C)]
struct ZSTy {
    leading_sized: u16,
    trailing_dst: [()],
}

let _ = ZSTy::ref_from_prefix(0u16.as_bytes()); // ⚠ Compile Error!
§Examples
use zerocopy::FromBytes;

#[derive(FromBytes, KnownLayout, Immutable)]
#[repr(C)]
struct PacketHeader {
    src_port: [u8; 2],
    dst_port: [u8; 2],
    length: [u8; 2],
    checksum: [u8; 2],
}

#[derive(FromBytes, KnownLayout, Immutable)]
#[repr(C)]
struct Packet {
    header: PacketHeader,
    body: [[u8; 2]],
}

// These are more bytes than are needed to encode a `Packet`.
let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14][..];

let (packet, suffix) = Packet::ref_from_prefix(bytes).unwrap();

assert_eq!(packet.header.src_port, [0, 1]);
assert_eq!(packet.header.dst_port, [2, 3]);
assert_eq!(packet.header.length, [4, 5]);
assert_eq!(packet.header.checksum, [6, 7]);
assert_eq!(packet.body, [[8, 9], [10, 11], [12, 13]]);
assert_eq!(suffix, &[14u8][..]);
Source

fn ref_from_suffix( source: &[u8], ) -> Result<(&[u8], &Self), CastError<&[u8], Self>>
where Self: Immutable + KnownLayout,

Interprets the suffix of the given bytes as a &Self.

This method computes the largest possible size of Self that can fit in the trailing bytes of source, then attempts to return both a reference to those bytes interpreted as a Self, and a reference to the preceding bytes. If there are insufficient bytes, or if that suffix of source is not appropriately aligned, this returns Err. If Self: Unaligned, you can infallibly discard the alignment error.

Self may be a sized type, a slice, or a slice DST.

§Compile-Time Assertions

This method cannot yet be used on unsized types whose dynamically-sized component is zero-sized. See ref_from_suffix_with_elems, which does support such types. Attempting to use this method on such types results in a compile-time assertion error; e.g.:

use zerocopy::*;

#[derive(FromBytes, Immutable, KnownLayout)]
#[repr(C)]
struct ZSTy {
    leading_sized: u16,
    trailing_dst: [()],
}

let _ = ZSTy::ref_from_suffix(0u16.as_bytes()); // ⚠ Compile Error!
§Examples
use zerocopy::FromBytes;

#[derive(FromBytes, Immutable, KnownLayout)]
#[repr(C)]
struct PacketTrailer {
    frame_check_sequence: [u8; 4],
}

// These are more bytes than are needed to encode a `PacketTrailer`.
let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];

let (prefix, trailer) = PacketTrailer::ref_from_suffix(bytes).unwrap();

assert_eq!(prefix, &[0, 1, 2, 3, 4, 5][..]);
assert_eq!(trailer.frame_check_sequence, [6, 7, 8, 9]);
Source

fn mut_from_bytes( source: &mut [u8], ) -> Result<&mut Self, CastError<&mut [u8], Self>>
where Self: IntoBytes + KnownLayout,

Interprets the given source as a &mut Self.

This method attempts to return a reference to source interpreted as a Self. If the length of source is not a valid size of Self, or if source is not appropriately aligned, this returns Err. If Self: Unaligned, you can infallibly discard the alignment error.

Self may be a sized type, a slice, or a slice DST.

§Compile-Time Assertions

This method cannot yet be used on unsized types whose dynamically-sized component is zero-sized. See mut_from_prefix_with_elems, which does support such types. Attempting to use this method on such types results in a compile-time assertion error; e.g.:

use zerocopy::*;

#[derive(FromBytes, Immutable, IntoBytes, KnownLayout)]
#[repr(C, packed)]
struct ZSTy {
    leading_sized: [u8; 2],
    trailing_dst: [()],
}

let mut source = [85, 85];
let _ = ZSTy::mut_from_bytes(&mut source[..]); // ⚠ Compile Error!
§Examples
use zerocopy::FromBytes;

#[derive(FromBytes, IntoBytes, KnownLayout, Immutable)]
#[repr(C)]
struct PacketHeader {
    src_port: [u8; 2],
    dst_port: [u8; 2],
    length: [u8; 2],
    checksum: [u8; 2],
}

// These bytes encode a `PacketHeader`.
let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7][..];

let header = PacketHeader::mut_from_bytes(bytes).unwrap();

assert_eq!(header.src_port, [0, 1]);
assert_eq!(header.dst_port, [2, 3]);
assert_eq!(header.length, [4, 5]);
assert_eq!(header.checksum, [6, 7]);

header.checksum = [0, 0];

assert_eq!(bytes, [0, 1, 2, 3, 4, 5, 0, 0]);
Source

fn mut_from_prefix( source: &mut [u8], ) -> Result<(&mut Self, &mut [u8]), CastError<&mut [u8], Self>>
where Self: IntoBytes + KnownLayout,

Interprets the prefix of the given source as a &mut Self without copying.

This method computes the largest possible size of Self that can fit in the leading bytes of source, then attempts to return both a reference to those bytes interpreted as a Self, and a reference to the remaining bytes. If there are insufficient bytes, or if source is not appropriately aligned, this returns Err. If Self: Unaligned, you can infallibly discard the alignment error.

Self may be a sized type, a slice, or a slice DST.

§Compile-Time Assertions

This method cannot yet be used on unsized types whose dynamically-sized component is zero-sized. See mut_from_suffix_with_elems, which does support such types. Attempting to use this method on such types results in a compile-time assertion error; e.g.:

use zerocopy::*;

#[derive(FromBytes, Immutable, IntoBytes, KnownLayout)]
#[repr(C, packed)]
struct ZSTy {
    leading_sized: [u8; 2],
    trailing_dst: [()],
}

let mut source = [85, 85];
let _ = ZSTy::mut_from_prefix(&mut source[..]); // ⚠ Compile Error!
§Examples
use zerocopy::FromBytes;

#[derive(FromBytes, IntoBytes, KnownLayout, Immutable)]
#[repr(C)]
struct PacketHeader {
    src_port: [u8; 2],
    dst_port: [u8; 2],
    length: [u8; 2],
    checksum: [u8; 2],
}

// These are more bytes than are needed to encode a `PacketHeader`.
let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];

let (header, body) = PacketHeader::mut_from_prefix(bytes).unwrap();

assert_eq!(header.src_port, [0, 1]);
assert_eq!(header.dst_port, [2, 3]);
assert_eq!(header.length, [4, 5]);
assert_eq!(header.checksum, [6, 7]);
assert_eq!(body, &[8, 9][..]);

header.checksum = [0, 0];
body.fill(1);

assert_eq!(bytes, [0, 1, 2, 3, 4, 5, 0, 0, 1, 1]);
Source

fn mut_from_suffix( source: &mut [u8], ) -> Result<(&mut [u8], &mut Self), CastError<&mut [u8], Self>>
where Self: IntoBytes + KnownLayout,

Interprets the suffix of the given source as a &mut Self without copying.

This method computes the largest possible size of Self that can fit in the trailing bytes of source, then attempts to return both a reference to those bytes interpreted as a Self, and a reference to the preceding bytes. If there are insufficient bytes, or if that suffix of source is not appropriately aligned, this returns Err. If Self: Unaligned, you can infallibly discard the alignment error.

Self may be a sized type, a slice, or a slice DST.

§Compile-Time Assertions

This method cannot yet be used on unsized types whose dynamically-sized component is zero-sized. Attempting to use this method on such types results in a compile-time assertion error; e.g.:

use zerocopy::*;

#[derive(FromBytes, Immutable, IntoBytes, KnownLayout)]
#[repr(C, packed)]
struct ZSTy {
    leading_sized: [u8; 2],
    trailing_dst: [()],
}

let mut source = [85, 85];
let _ = ZSTy::mut_from_suffix(&mut source[..]); // ⚠ Compile Error!
§Examples
use zerocopy::FromBytes;

#[derive(FromBytes, IntoBytes, KnownLayout, Immutable)]
#[repr(C)]
struct PacketTrailer {
    frame_check_sequence: [u8; 4],
}

// These are more bytes than are needed to encode a `PacketTrailer`.
let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];

let (prefix, trailer) = PacketTrailer::mut_from_suffix(bytes).unwrap();

assert_eq!(prefix, &[0u8, 1, 2, 3, 4, 5][..]);
assert_eq!(trailer.frame_check_sequence, [6, 7, 8, 9]);

prefix.fill(0);
trailer.frame_check_sequence.fill(1);

assert_eq!(bytes, [0, 0, 0, 0, 0, 0, 1, 1, 1, 1]);
Source

fn ref_from_bytes_with_elems( source: &[u8], count: usize, ) -> Result<&Self, CastError<&[u8], Self>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the given source as a &Self with a DST length equal to count.

This method attempts to return a reference to source interpreted as a Self with count trailing elements. If the length of source is not equal to the size of Self with count elements, or if source is not appropriately aligned, this returns Err. If Self: Unaligned, you can infallibly discard the alignment error.

§Examples
use zerocopy::FromBytes;

#[derive(FromBytes, Immutable)]
#[repr(C)]
struct Pixel {
    r: u8,
    g: u8,
    b: u8,
    a: u8,
}

let bytes = &[0, 1, 2, 3, 4, 5, 6, 7][..];

let pixels = <[Pixel]>::ref_from_bytes_with_elems(bytes, 2).unwrap();

assert_eq!(pixels, &[
    Pixel { r: 0, g: 1, b: 2, a: 3 },
    Pixel { r: 4, g: 5, b: 6, a: 7 },
]);

Since an explicit count is provided, this method supports types with zero-sized trailing slice elements. Methods such as ref_from_bytes which do not take an explicit count do not support such types.

use zerocopy::*;

#[derive(FromBytes, Immutable, KnownLayout)]
#[repr(C)]
struct ZSTy {
    leading_sized: [u8; 2],
    trailing_dst: [()],
}

let src = &[85, 85][..];
let zsty = ZSTy::ref_from_bytes_with_elems(src, 42).unwrap();
assert_eq!(zsty.trailing_dst.len(), 42);
Source

fn ref_from_prefix_with_elems( source: &[u8], count: usize, ) -> Result<(&Self, &[u8]), CastError<&[u8], Self>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the prefix of the given source as a DST &Self with length equal to count.

This method attempts to return a reference to the prefix of source interpreted as a Self with count trailing elements, and a reference to the remaining bytes. If there are insufficient bytes, or if source is not appropriately aligned, this returns Err. If Self: Unaligned, you can infallibly discard the alignment error.

§Examples
use zerocopy::FromBytes;

#[derive(FromBytes, Immutable)]
#[repr(C)]
struct Pixel {
    r: u8,
    g: u8,
    b: u8,
    a: u8,
}

// These are more bytes than are needed to encode two `Pixel`s.
let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];

let (pixels, suffix) = <[Pixel]>::ref_from_prefix_with_elems(bytes, 2).unwrap();

assert_eq!(pixels, &[
    Pixel { r: 0, g: 1, b: 2, a: 3 },
    Pixel { r: 4, g: 5, b: 6, a: 7 },
]);

assert_eq!(suffix, &[8, 9]);

Since an explicit count is provided, this method supports types with zero-sized trailing slice elements. Methods such as ref_from_prefix which do not take an explicit count do not support such types.

use zerocopy::*;

#[derive(FromBytes, Immutable, KnownLayout)]
#[repr(C)]
struct ZSTy {
    leading_sized: [u8; 2],
    trailing_dst: [()],
}

let src = &[85, 85][..];
let (zsty, _) = ZSTy::ref_from_prefix_with_elems(src, 42).unwrap();
assert_eq!(zsty.trailing_dst.len(), 42);
Source

fn ref_from_suffix_with_elems( source: &[u8], count: usize, ) -> Result<(&[u8], &Self), CastError<&[u8], Self>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the suffix of the given source as a DST &Self with length equal to count.

This method attempts to return a reference to the suffix of source interpreted as a Self with count trailing elements, and a reference to the preceding bytes. If there are insufficient bytes, or if that suffix of source is not appropriately aligned, this returns Err. If Self: Unaligned, you can infallibly discard the alignment error.

§Examples
use zerocopy::FromBytes;

#[derive(FromBytes, Immutable)]
#[repr(C)]
struct Pixel {
    r: u8,
    g: u8,
    b: u8,
    a: u8,
}

// These are more bytes than are needed to encode two `Pixel`s.
let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];

let (prefix, pixels) = <[Pixel]>::ref_from_suffix_with_elems(bytes, 2).unwrap();

assert_eq!(prefix, &[0, 1]);

assert_eq!(pixels, &[
    Pixel { r: 2, g: 3, b: 4, a: 5 },
    Pixel { r: 6, g: 7, b: 8, a: 9 },
]);

Since an explicit count is provided, this method supports types with zero-sized trailing slice elements. Methods such as ref_from_suffix which do not take an explicit count do not support such types.

use zerocopy::*;

#[derive(FromBytes, Immutable, KnownLayout)]
#[repr(C)]
struct ZSTy {
    leading_sized: [u8; 2],
    trailing_dst: [()],
}

let src = &[85, 85][..];
let (_, zsty) = ZSTy::ref_from_suffix_with_elems(src, 42).unwrap();
assert_eq!(zsty.trailing_dst.len(), 42);
Source

fn mut_from_bytes_with_elems( source: &mut [u8], count: usize, ) -> Result<&mut Self, CastError<&mut [u8], Self>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the given source as a &mut Self with a DST length equal to count.

This method attempts to return a reference to source interpreted as a Self with count trailing elements. If the length of source is not equal to the size of Self with count elements, or if source is not appropriately aligned, this returns Err. If Self: Unaligned, you can infallibly discard the alignment error.

§Examples
use zerocopy::FromBytes;

#[derive(KnownLayout, FromBytes, IntoBytes, Immutable)]
#[repr(C)]
struct Pixel {
    r: u8,
    g: u8,
    b: u8,
    a: u8,
}

let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7][..];

let pixels = <[Pixel]>::mut_from_bytes_with_elems(bytes, 2).unwrap();

assert_eq!(pixels, &[
    Pixel { r: 0, g: 1, b: 2, a: 3 },
    Pixel { r: 4, g: 5, b: 6, a: 7 },
]);

pixels[1] = Pixel { r: 0, g: 0, b: 0, a: 0 };

assert_eq!(bytes, [0, 1, 2, 3, 0, 0, 0, 0]);

Since an explicit count is provided, this method supports types with zero-sized trailing slice elements. Methods such as mut_from which do not take an explicit count do not support such types.

use zerocopy::*;

#[derive(FromBytes, IntoBytes, Immutable, KnownLayout)]
#[repr(C, packed)]
struct ZSTy {
    leading_sized: [u8; 2],
    trailing_dst: [()],
}

let src = &mut [85, 85][..];
let zsty = ZSTy::mut_from_bytes_with_elems(src, 42).unwrap();
assert_eq!(zsty.trailing_dst.len(), 42);
Source

fn mut_from_prefix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut Self, &mut [u8]), CastError<&mut [u8], Self>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize>,

Interprets the prefix of the given source as a &mut Self with DST length equal to count.

This method attempts to return a reference to the prefix of source interpreted as a Self with count trailing elements, and a reference to the preceding bytes. If there are insufficient bytes, or if source is not appropriately aligned, this returns Err. If Self: Unaligned, you can infallibly discard the alignment error.

§Examples
use zerocopy::FromBytes;

#[derive(KnownLayout, FromBytes, IntoBytes, Immutable)]
#[repr(C)]
struct Pixel {
    r: u8,
    g: u8,
    b: u8,
    a: u8,
}

// These are more bytes than are needed to encode two `Pixel`s.
let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];

let (pixels, suffix) = <[Pixel]>::mut_from_prefix_with_elems(bytes, 2).unwrap();

assert_eq!(pixels, &[
    Pixel { r: 0, g: 1, b: 2, a: 3 },
    Pixel { r: 4, g: 5, b: 6, a: 7 },
]);

assert_eq!(suffix, &[8, 9]);

pixels[1] = Pixel { r: 0, g: 0, b: 0, a: 0 };
suffix.fill(1);

assert_eq!(bytes, [0, 1, 2, 3, 0, 0, 0, 0, 1, 1]);

Since an explicit count is provided, this method supports types with zero-sized trailing slice elements. Methods such as mut_from_prefix which do not take an explicit count do not support such types.

use zerocopy::*;

#[derive(FromBytes, IntoBytes, Immutable, KnownLayout)]
#[repr(C, packed)]
struct ZSTy {
    leading_sized: [u8; 2],
    trailing_dst: [()],
}

let src = &mut [85, 85][..];
let (zsty, _) = ZSTy::mut_from_prefix_with_elems(src, 42).unwrap();
assert_eq!(zsty.trailing_dst.len(), 42);
Source

fn mut_from_suffix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut [u8], &mut Self), CastError<&mut [u8], Self>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize>,

Interprets the suffix of the given source as a &mut Self with DST length equal to count.

This method attempts to return a reference to the suffix of source interpreted as a Self with count trailing elements, and a reference to the remaining bytes. If there are insufficient bytes, or if that suffix of source is not appropriately aligned, this returns Err. If Self: Unaligned, you can infallibly discard the alignment error.

§Examples
use zerocopy::FromBytes;

#[derive(FromBytes, IntoBytes, Immutable)]
#[repr(C)]
struct Pixel {
    r: u8,
    g: u8,
    b: u8,
    a: u8,
}

// These are more bytes than are needed to encode two `Pixel`s.
let bytes = &mut [0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];

let (prefix, pixels) = <[Pixel]>::mut_from_suffix_with_elems(bytes, 2).unwrap();

assert_eq!(prefix, &[0, 1]);

assert_eq!(pixels, &[
    Pixel { r: 2, g: 3, b: 4, a: 5 },
    Pixel { r: 6, g: 7, b: 8, a: 9 },
]);

prefix.fill(9);
pixels[1] = Pixel { r: 0, g: 0, b: 0, a: 0 };

assert_eq!(bytes, [9, 9, 2, 3, 4, 5, 0, 0, 0, 0]);

Since an explicit count is provided, this method supports types with zero-sized trailing slice elements. Methods such as mut_from_suffix which do not take an explicit count do not support such types.

use zerocopy::*;

#[derive(FromBytes, IntoBytes, Immutable, KnownLayout)]
#[repr(C, packed)]
struct ZSTy {
    leading_sized: [u8; 2],
    trailing_dst: [()],
}

let src = &mut [85, 85][..];
let (_, zsty) = ZSTy::mut_from_suffix_with_elems(src, 42).unwrap();
assert_eq!(zsty.trailing_dst.len(), 42);
Source

fn read_from_bytes(source: &[u8]) -> Result<Self, SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the given source.

If source.len() != size_of::<Self>(), read_from_bytes returns Err.

§Examples
use zerocopy::FromBytes;

#[derive(FromBytes)]
#[repr(C)]
struct PacketHeader {
    src_port: [u8; 2],
    dst_port: [u8; 2],
    length: [u8; 2],
    checksum: [u8; 2],
}

// These bytes encode a `PacketHeader`.
let bytes = &[0, 1, 2, 3, 4, 5, 6, 7][..];

let header = PacketHeader::read_from_bytes(bytes).unwrap();

assert_eq!(header.src_port, [0, 1]);
assert_eq!(header.dst_port, [2, 3]);
assert_eq!(header.length, [4, 5]);
assert_eq!(header.checksum, [6, 7]);
Source

fn read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the prefix of the given source.

This attempts to read a Self from the first size_of::<Self>() bytes of source, returning that Self and any remaining bytes. If source.len() < size_of::<Self>(), it returns Err.

§Examples
use zerocopy::FromBytes;

#[derive(FromBytes)]
#[repr(C)]
struct PacketHeader {
    src_port: [u8; 2],
    dst_port: [u8; 2],
    length: [u8; 2],
    checksum: [u8; 2],
}

// These are more bytes than are needed to encode a `PacketHeader`.
let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];

let (header, body) = PacketHeader::read_from_prefix(bytes).unwrap();

assert_eq!(header.src_port, [0, 1]);
assert_eq!(header.dst_port, [2, 3]);
assert_eq!(header.length, [4, 5]);
assert_eq!(header.checksum, [6, 7]);
assert_eq!(body, [8, 9]);
Source

fn read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the suffix of the given source.

This attempts to read a Self from the last size_of::<Self>() bytes of source, returning that Self and any preceding bytes. If source.len() < size_of::<Self>(), it returns Err.

§Examples
use zerocopy::FromBytes;

#[derive(FromBytes)]
#[repr(C)]
struct PacketTrailer {
    frame_check_sequence: [u8; 4],
}

// These are more bytes than are needed to encode a `PacketTrailer`.
let bytes = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9][..];

let (prefix, trailer) = PacketTrailer::read_from_suffix(bytes).unwrap();

assert_eq!(prefix, [0, 1, 2, 3, 4, 5]);
assert_eq!(trailer.frame_check_sequence, [6, 7, 8, 9]);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FromBytes for Option<NonZeroI8>

Source§

impl FromBytes for Option<NonZeroI16>

Source§

impl FromBytes for Option<NonZeroI32>

Source§

impl FromBytes for Option<NonZeroI64>

Source§

impl FromBytes for Option<NonZeroI128>

Source§

impl FromBytes for Option<NonZeroIsize>

Source§

impl FromBytes for Option<NonZeroU8>

Source§

impl FromBytes for Option<NonZeroU16>

Source§

impl FromBytes for Option<NonZeroU32>

Source§

impl FromBytes for Option<NonZeroU64>

Source§

impl FromBytes for Option<NonZeroU128>

Source§

impl FromBytes for Option<NonZeroUsize>

Source§

impl FromBytes for f32

Source§

impl FromBytes for f64

Source§

impl FromBytes for i8

Source§

impl FromBytes for i16

Source§

impl FromBytes for i32

Source§

impl FromBytes for i64

Source§

impl FromBytes for i128

Source§

impl FromBytes for isize

Source§

impl FromBytes for u8

Source§

impl FromBytes for u16

Source§

impl FromBytes for u32

Source§

impl FromBytes for u64

Source§

impl FromBytes for u128

Source§

impl FromBytes for ()

Source§

impl FromBytes for usize

Source§

impl FromBytes for __m128

Source§

impl FromBytes for __m128d

Source§

impl FromBytes for __m128i

Source§

impl FromBytes for __m256

Source§

impl FromBytes for __m256d

Source§

impl FromBytes for __m256i

Source§

impl FromBytes for AtomicI8

Source§

impl FromBytes for AtomicI16

Source§

impl FromBytes for AtomicI32

Source§

impl FromBytes for AtomicI64

Source§

impl FromBytes for AtomicIsize

Source§

impl FromBytes for AtomicU8

Source§

impl FromBytes for AtomicU16

Source§

impl FromBytes for AtomicU32

Source§

impl FromBytes for AtomicU64

Source§

impl FromBytes for AtomicUsize

Source§

impl<T> FromBytes for MaybeUninit<T>

Source§

impl<T: FromBytes> FromBytes for [T]

Source§

impl<T: FromBytes> FromBytes for Wrapping<T>

Source§

impl<T: FromBytes, const N: usize> FromBytes for [T; N]

Source§

impl<T: ?Sized + FromBytes> FromBytes for UnsafeCell<T>

Source§

impl<T: ?Sized + FromBytes> FromBytes for ManuallyDrop<T>

Source§

impl<T: ?Sized> FromBytes for PhantomData<T>

Implementors§

Source§

impl<O> FromBytes for F32<O>

Source§

impl<O> FromBytes for F64<O>

Source§

impl<O> FromBytes for I16<O>

Source§

impl<O> FromBytes for I32<O>

Source§

impl<O> FromBytes for I64<O>

Source§

impl<O> FromBytes for I128<O>

Source§

impl<O> FromBytes for Isize<O>

Source§

impl<O> FromBytes for U16<O>

Source§

impl<O> FromBytes for U32<O>

Source§

impl<O> FromBytes for U64<O>

Source§

impl<O> FromBytes for U128<O>

Source§

impl<O> FromBytes for Usize<O>

Source§

impl<T> FromBytes for Unalign<T>
where T: FromBytes,

impl FromBytes for BlockFifoCommand
where u8: FromBytes, [u8; 3]: FromBytes, u32: FromBytes,

impl FromBytes for BlockFifoRequest
where block_fifo_command_t: FromBytes, reqid_t: FromBytes, groupid_t: FromBytes, vmoid_t: FromBytes, u32: FromBytes, u64: FromBytes,

impl FromBytes for BlockFifoResponse
where zx_status_t: FromBytes, reqid_t: FromBytes, groupid_t: FromBytes, u16: FromBytes, u32: FromBytes, [u64; 4]: FromBytes,

impl FromBytes for Header
where u64: FromBytes,

impl FromBytes for EapolFields
where ProtocolVersion: FromBytes, PacketType: FromBytes, BigEndianU16: FromBytes,

impl FromBytes for KeyDescriptor
where u8: FromBytes,

impl FromBytes for KeyFrameFields
where KeyDescriptor: FromBytes, BigEndianU16: FromBytes, BigEndianU64: FromBytes, [u8; 32]: FromBytes, [u8; 16]: FromBytes, [u8; 8]: FromBytes,

impl FromBytes for KeyInformation
where u16: FromBytes,

impl FromBytes for PacketType
where u8: FromBytes,

impl FromBytes for ProtocolVersion
where u8: FromBytes,

impl FromBytes for BlockGroupDesc32
where U32: FromBytes, U16: FromBytes,

impl FromBytes for DirEntryHeader
where U32: FromBytes, U16: FromBytes, u8: FromBytes,

impl FromBytes for Extent
where U32: FromBytes, U16: FromBytes,

impl FromBytes for ExtentHeader
where U16: FromBytes, U32: FromBytes,

impl FromBytes for ExtentIndex
where U32: FromBytes, U16: FromBytes,

impl FromBytes for INode
where U16: FromBytes, U32: FromBytes, [u8; 4]: FromBytes, [u8; 60]: FromBytes,

impl FromBytes for SuperBlock
where U32: FromBytes, U16: FromBytes, [u8; 16]: FromBytes, [u8; 64]: FromBytes, u8: FromBytes, [U32; 4]: FromBytes, [U32; 17]: FromBytes, U64: FromBytes, [u8; 32]: FromBytes, [U32; 2]: FromBytes, [u8; 4]: FromBytes, [U32; 98]: FromBytes,

impl FromBytes for XattrEntryHeader
where u8: FromBytes, U16: FromBytes, U32: FromBytes,

impl FromBytes for XattrHeader
where U32: FromBytes, [u8; 8]: FromBytes,

impl<B> FromBytes for ExtentTreeNode<B>
where Ref<B, ExtentHeader>: FromBytes, B: FromBytes + SplitByteSlice,

impl FromBytes for BoardInfo
where u32: FromBytes,

impl FromBytes for DcfgAmlogicHdcpDriver
where u64: FromBytes,

impl FromBytes for DcfgAmlogicRngDriver
where u64: FromBytes,

impl FromBytes for DcfgArmGenericTimerDriver
where u32: FromBytes,

impl FromBytes for DcfgArmGicV2Driver
where u64: FromBytes, u32: FromBytes, u8: FromBytes, u16: FromBytes,

impl FromBytes for DcfgArmGicV3Driver
where u64: FromBytes, u32: FromBytes, u8: FromBytes, [u8; 3]: FromBytes,

impl FromBytes for DcfgArmPsciDriver
where u8: FromBytes, [u8; 7]: FromBytes, [u64; 3]: FromBytes,

impl FromBytes for DcfgGeneric32Watchdog
where DcfgGeneric32WatchdogAction: FromBytes, i64: FromBytes, KernelDriverGeneric32WatchdogFlags: FromBytes, u32: FromBytes,

impl FromBytes for DcfgGeneric32WatchdogAction
where u64: FromBytes, u32: FromBytes,

impl FromBytes for DcfgRiscvGenericTimerDriver
where u32: FromBytes,

impl FromBytes for DcfgRiscvPlicDriver
where u64: FromBytes, u32: FromBytes,

impl FromBytes for DcfgSimple
where u64: FromBytes, u32: FromBytes,

impl FromBytes for DcfgSimplePio
where u16: FromBytes, u32: FromBytes,

impl FromBytes for Flags
where u32: FromBytes,

impl FromBytes for Kernel
where u64: FromBytes,

impl FromBytes for KernelDriverGeneric32WatchdogFlags
where u32: FromBytes,

impl FromBytes for KernelDriverIrqFlags
where u32: FromBytes,

impl FromBytes for Nvram
where u64: FromBytes,

impl FromBytes for Partition
where PartitionGuid: FromBytes, u64: FromBytes, [u8; 32]: FromBytes,

impl FromBytes for PartitionMap
where u64: FromBytes, u32: FromBytes, PartitionGuid: FromBytes,

impl FromBytes for PlatformId
where u32: FromBytes, [u8; 32]: FromBytes,

impl FromBytes for TopologyArm64Info
where u8: FromBytes,

impl FromBytes for TopologyCache
where u32: FromBytes,

impl FromBytes for TopologyCluster
where u8: FromBytes,

impl FromBytes for TopologyDie
where u64: FromBytes,

impl FromBytes for TopologyNumaRegion
where u64: FromBytes,

impl FromBytes for TopologyProcessorFlags
where u16: FromBytes,

impl FromBytes for TopologyRiscv64Info
where u64: FromBytes, u32: FromBytes,

impl FromBytes for TopologySocket
where u64: FromBytes,

impl FromBytes for TopologyX64Info
where [u32; 4]: FromBytes, u32: FromBytes,

impl FromBytes for ArrayMembers
where [u8; 10]: FromBytes, [Singleton; 6]: FromBytes, [[u8; 10]; 20]: FromBytes, [[[i8; 1]; 2]; 3]: FromBytes,

impl FromBytes for Bits
where u16: FromBytes,

impl FromBytes for Empty

impl FromBytes for zbi_bootfs_dirent_t
where U32: FromBytes,

impl FromBytes for zbi_bootfs_header_t
where U32: FromBytes,

impl FromBytes for ZbiTopologyArm64Info
where u8: FromBytes,

impl FromBytes for ZbiTopologyCache
where u32: FromBytes,

impl FromBytes for ZbiTopologyCluster
where u8: FromBytes,

impl FromBytes for ZbiTopologyNode
where u8: FromBytes, u16: FromBytes, Entity: FromBytes,

impl FromBytes for ZbiTopologyNumaRegion
where u64: FromBytes,

impl FromBytes for ZbiTopologyProcessor
where [u16; 4]: FromBytes, u8: FromBytes, u16: FromBytes, ArchitectureInfo: FromBytes,

impl FromBytes for ZbiTopologyX64Info
where [u32; 4]: FromBytes, u32: FromBytes,

impl FromBytes for zbi_header_t
where U32: FromBytes,

impl FromBytes for ArchitectureInfo
where ZbiTopologyArm64Info: FromBytes + Immutable, ZbiTopologyX64Info: FromBytes + Immutable,

impl FromBytes for Entity
where ZbiTopologyProcessor: FromBytes + Immutable, ZbiTopologyCluster: FromBytes + Immutable, ZbiTopologyNumaRegion: FromBytes + Immutable, ZbiTopologyCache: FromBytes + Immutable,

impl FromBytes for Header
where [u8; 8]: FromBytes, u32: FromBytes, u64: FromBytes, [u8; 16]: FromBytes,

impl FromBytes for PartitionTableEntry
where [u8; 16]: FromBytes, u64: FromBytes, [u16; 36]: FromBytes,

impl FromBytes for Bssid
where [u8; 6]: FromBytes,

impl FromBytes for MacAddr
where [u8; 6]: FromBytes,

impl FromBytes for Type00Config
where u16: FromBytes, u8: FromBytes, [u32; 6]: FromBytes, u32: FromBytes, [u8; 3]: FromBytes, [u8; 4]: FromBytes,

impl FromBytes for Type01Config
where u16: FromBytes, u8: FromBytes, [u32; 2]: FromBytes, u32: FromBytes, [u8; 3]: FromBytes,

impl FromBytes for magma_buffer_info
where u64: FromBytes,

impl FromBytes for magma_buffer_offset
where u64: FromBytes,

impl FromBytes for magma_exec_command_buffer
where u32: FromBytes, u64: FromBytes,

impl FromBytes for magma_exec_resource
where magma_buffer_id_t: FromBytes, u64: FromBytes,

impl FromBytes for magma_image_create_info
where u64: FromBytes, [u64; 16]: FromBytes, u32: FromBytes,

impl FromBytes for magma_image_info
where [u64; 4]: FromBytes, [u32; 4]: FromBytes, u64: FromBytes, u32: FromBytes,

impl FromBytes for magma_total_time_query_result
where u64: FromBytes,

impl FromBytes for virtio_magma_buffer_clean_cache_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_buffer_clean_cache_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_buffer_export_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_buffer_export_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_buffer_get_cache_policy_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_buffer_get_cache_policy_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_buffer_get_handle_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_buffer_get_handle_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_buffer_get_info_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_buffer_get_info_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_buffer_set_cache_policy_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_buffer_set_cache_policy_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_buffer_set_name_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_buffer_set_name_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_config
where u64: FromBytes,

impl FromBytes for virtio_magma_connection_create_buffer_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_create_buffer_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_create_context_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_create_context_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_create_semaphore_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_create_semaphore_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_dump_performance_counters_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes, u32: FromBytes,

impl FromBytes for virtio_magma_connection_enable_performance_counter_access_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes, u32: FromBytes,

impl FromBytes for virtio_magma_connection_execute_command_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes, u32: FromBytes,

impl FromBytes for virtio_magma_connection_execute_command_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_execute_immediate_commands_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes, u32: FromBytes,

impl FromBytes for virtio_magma_connection_flush_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_flush_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_get_error_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_get_error_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_import_buffer_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes, u32: FromBytes,

impl FromBytes for virtio_magma_connection_import_buffer_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_import_semaphore2_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes, u32: FromBytes,

impl FromBytes for virtio_magma_connection_import_semaphore2_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_map_buffer_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_map_buffer_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_perform_buffer_op_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes, u32: FromBytes,

impl FromBytes for virtio_magma_connection_perform_buffer_op_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_release_buffer_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_release_context_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes, u32: FromBytes,

impl FromBytes for virtio_magma_connection_release_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_release_semaphore_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_connection_unmap_buffer_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_ctrl_hdr
where u32: FromBytes,

impl FromBytes for virtio_magma_device_create_connection_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_device_create_connection_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_device_import_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u32: FromBytes,

impl FromBytes for virtio_magma_device_import_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_device_query_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_device_query_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_device_release_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_device_release_resp
where virtio_magma_ctrl_hdr_t: FromBytes,

impl FromBytes for virtio_magma_initialize_logging_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u32: FromBytes,

impl FromBytes for virtio_magma_initialize_logging_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_initialize_tracing_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u32: FromBytes,

impl FromBytes for virtio_magma_initialize_tracing_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_internal_map_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u32: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_internal_map_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_internal_release_handle_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u32: FromBytes,

impl FromBytes for virtio_magma_internal_release_handle_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_internal_unmap_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u32: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_internal_unmap_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_poll_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes, u32: FromBytes,

impl FromBytes for virtio_magma_poll_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_semaphore_export_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_semaphore_export_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_semaphore_reset_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_semaphore_signal_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_virt_connection_create_image_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_virt_connection_create_image_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_virt_connection_get_image_info_ctrl
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtio_magma_virt_connection_get_image_info_resp
where virtio_magma_ctrl_hdr_t: FromBytes, u64: FromBytes,

impl FromBytes for virtmagma_buffer_set_name_wrapper
where __u64: FromBytes,

impl FromBytes for virtmagma_command_descriptor
where __u64: FromBytes,

impl FromBytes for virtmagma_create_image_wrapper
where __u64: FromBytes,

impl FromBytes for virtmagma_get_image_info_wrapper
where __u64: FromBytes,

impl FromBytes for virtmagma_ioctl_args_handshake
where __u32: FromBytes,

impl FromBytes for virtmagma_ioctl_args_magma_command
where __u64: FromBytes,

impl FromBytes for A
where [u8; 4]: FromBytes,

impl FromBytes for Aaaa
where [u8; 16]: FromBytes,

impl FromBytes for Header
where U16: FromBytes,

impl FromBytes for Mac
where [u8; 6]: FromBytes,

impl FromBytes for Ipv4Addr
where [u8; 4]: FromBytes,

impl FromBytes for Ipv6Addr
where [u8; 16]: FromBytes,

impl FromBytes for PacketHead
where U32: FromBytes,

impl FromBytes for Mldv1Message
where U16: FromBytes, Ipv6Addr: FromBytes,

impl FromBytes for Mldv2QueryMessageHeader
where U16: FromBytes, Ipv6Addr: FromBytes, u8: FromBytes,

impl FromBytes for Mldv2ReportHeader
where [u8; 2]: FromBytes, U16: FromBytes,

impl FromBytes for Mldv2ReportRecordHeader
where u8: FromBytes, U16: FromBytes, Ipv6Addr: FromBytes,

impl FromBytes for MulticastListenerDone

impl FromBytes for MulticastListenerQuery

impl FromBytes for MulticastListenerQueryV2

impl FromBytes for MulticastListenerReport

impl FromBytes for MulticastListenerReportV2

impl FromBytes for PrefixInformation
where u8: FromBytes, U32: FromBytes, [u8; 4]: FromBytes, Ipv6Addr: FromBytes,

impl FromBytes for NeighborAdvertisement
where u8: FromBytes, [u8; 3]: FromBytes, Ipv6Addr: FromBytes,

impl FromBytes for NeighborSolicitation
where [u8; 4]: FromBytes, Ipv6Addr: FromBytes,

impl FromBytes for Redirect
where [u8; 4]: FromBytes, Ipv6Addr: FromBytes,

impl FromBytes for RouterAdvertisement
where u8: FromBytes, U16: FromBytes, U32: FromBytes,

impl FromBytes for RouterSolicitation
where [u8; 4]: FromBytes,

impl FromBytes for IcmpDestUnreachable
where [u8; 2]: FromBytes, U16: FromBytes,

impl FromBytes for IcmpEchoReply
where IdAndSeq: FromBytes,

impl FromBytes for IcmpEchoRequest
where IdAndSeq: FromBytes,

impl FromBytes for IcmpTimeExceeded
where [u8; 4]: FromBytes,

impl FromBytes for Icmpv4ParameterProblem
where u8: FromBytes, [u8; 3]: FromBytes,

impl FromBytes for Icmpv4Redirect
where Ipv4Addr: FromBytes,

impl FromBytes for Icmpv4TimestampReply
where Timestamp: FromBytes,

impl FromBytes for Icmpv4TimestampRequest
where Timestamp: FromBytes,

impl FromBytes for Icmpv6PacketTooBig
where U32: FromBytes,

impl FromBytes for Icmpv6ParameterProblem
where U32: FromBytes,

impl FromBytes for GroupRecordHeader
where u8: FromBytes, U16: FromBytes, Ipv4Addr: FromBytes,

impl FromBytes for MembershipQueryData
where Ipv4Addr: FromBytes, u8: FromBytes, U16: FromBytes,

impl FromBytes for MembershipReportV3Data
where [u8; 2]: FromBytes, U16: FromBytes,

impl FromBytes for HeaderPrefix
where u8: FromBytes, [u8; 2]: FromBytes,

impl FromBytes for DscpAndEcn
where u8: FromBytes,

impl FromBytes for HeaderPrefix
where u8: FromBytes, DscpAndEcn: FromBytes, U16: FromBytes, [u8; 2]: FromBytes, Ipv4Addr: FromBytes,

impl FromBytes for FixedHeader
where [u8; 4]: FromBytes, U16: FromBytes, u8: FromBytes, Ipv6Addr: FromBytes,

impl FromBytes for TcpSackBlock
where U32: FromBytes,

impl FromBytes for TcpFlowAndSeqNum
where TcpFlowHeader: FromBytes, U32: FromBytes,

impl FromBytes for TcpFlowHeader
where U16: FromBytes,

impl FromBytes for Elf32Dyn
where u32: FromBytes,

impl FromBytes for Elf32FileHeader
where ElfIdent: FromBytes, u16: FromBytes, u32: FromBytes,

impl FromBytes for Elf32ProgramHeader
where u32: FromBytes,

impl FromBytes for Elf64Dyn
where u64: FromBytes,

impl FromBytes for Elf64FileHeader
where ElfIdent: FromBytes, u16: FromBytes, u32: FromBytes, usize: FromBytes,

impl FromBytes for Elf64ProgramHeader
where u32: FromBytes, usize: FromBytes, u64: FromBytes,

impl FromBytes for ElfIdent
where [u8; 4]: FromBytes, u8: FromBytes, [u8; 7]: FromBytes,

impl FromBytes for elf32_sym
where Elf32Word: FromBytes, u8: FromBytes, Elf32Half: FromBytes, Elf32Addr: FromBytes,

impl FromBytes for elf64_sym
where Elf64Word: FromBytes, u8: FromBytes, Elf64Half: FromBytes, Elf64Addr: FromBytes, Elf64Xword: FromBytes,

impl FromBytes for AtomicI16_be
where AtomicI16: FromBytes,

impl FromBytes for AtomicI16_le
where AtomicI16: FromBytes,

impl FromBytes for AtomicI32_be
where AtomicI32: FromBytes,

impl FromBytes for AtomicI32_le
where AtomicI32: FromBytes,

impl FromBytes for AtomicI64_be
where AtomicI64: FromBytes,

impl FromBytes for AtomicI64_le
where AtomicI64: FromBytes,

impl FromBytes for AtomicU16_be
where AtomicU16: FromBytes,

impl FromBytes for AtomicU16_le
where AtomicU16: FromBytes,

impl FromBytes for AtomicU32_be
where AtomicU32: FromBytes,

impl FromBytes for AtomicU32_le
where AtomicU32: FromBytes,

impl FromBytes for AtomicU64_be
where AtomicU64: FromBytes,

impl FromBytes for AtomicU64_le
where AtomicU64: FromBytes,

impl FromBytes for f32_be
where f32: FromBytes,

impl FromBytes for f32_le
where f32: FromBytes,

impl FromBytes for f64_be
where f64: FromBytes,

impl FromBytes for f64_le
where f64: FromBytes,

impl FromBytes for i128_be
where i128: FromBytes,

impl FromBytes for i128_le
where i128: FromBytes,

impl FromBytes for i16_be
where i16: FromBytes,

impl FromBytes for i16_le
where i16: FromBytes,

impl FromBytes for i32_be
where i32: FromBytes,

impl FromBytes for i32_le
where i32: FromBytes,

impl FromBytes for i64_be
where i64: FromBytes,

impl FromBytes for i64_le
where i64: FromBytes,

impl FromBytes for u128_be
where u128: FromBytes,

impl FromBytes for u128_le
where u128: FromBytes,

impl FromBytes for u16_be
where u16: FromBytes,

impl FromBytes for u16_le
where u16: FromBytes,

impl FromBytes for u32_be
where u32: FromBytes,

impl FromBytes for u32_le
where u32: FromBytes,

impl FromBytes for u64_be
where u64: FromBytes,

impl FromBytes for u64_le
where u64: FromBytes,

impl FromBytes for f32_ube
where f32: FromBytes,

impl FromBytes for f32_ule
where f32: FromBytes,

impl FromBytes for f64_ube
where f64: FromBytes,

impl FromBytes for f64_ule
where f64: FromBytes,

impl FromBytes for i128_ube
where i128: FromBytes,

impl FromBytes for i128_ule
where i128: FromBytes,

impl FromBytes for i16_ube
where i16: FromBytes,

impl FromBytes for i16_ule
where i16: FromBytes,

impl FromBytes for i32_ube
where i32: FromBytes,

impl FromBytes for i32_ule
where i32: FromBytes,

impl FromBytes for i64_ube
where i64: FromBytes,

impl FromBytes for i64_ule
where i64: FromBytes,

impl FromBytes for u128_ube
where u128: FromBytes,

impl FromBytes for u128_ule
where u128: FromBytes,

impl FromBytes for u16_ube
where u16: FromBytes,

impl FromBytes for u16_ule
where u16: FromBytes,

impl FromBytes for u32_ube
where u32: FromBytes,

impl FromBytes for u32_ule
where u32: FromBytes,

impl FromBytes for u64_ube
where u64: FromBytes,

impl FromBytes for u64_ule
where u64: FromBytes,

impl FromBytes for EUI48
where [u8; 6]: FromBytes,

impl FromBytes for EUI64
where [u8; 8]: FromBytes,

impl FromBytes for BigEndianU128
where [u8; 16]: FromBytes,

impl FromBytes for BigEndianU16
where [u8; 2]: FromBytes,

impl FromBytes for BigEndianU32
where [u8; 4]: FromBytes,

impl FromBytes for BigEndianU64
where [u8; 8]: FromBytes,

impl FromBytes for AmpduParams
where u8: FromBytes,

impl FromBytes for ApWmmInfo
where u8: FromBytes,

impl FromBytes for AselCapability
where u8: FromBytes,

impl FromBytes for BitmapControl
where u8: FromBytes,

impl FromBytes for BssMaxIdlePeriod
where u16: FromBytes, IdleOptions: FromBytes,

impl FromBytes for ChannelSwitchAnnouncement
where u8: FromBytes,

impl FromBytes for ClientWmmInfo
where u8: FromBytes,

impl FromBytes for DsssParamSet
where u8: FromBytes,

impl FromBytes for EcwMinMax
where u8: FromBytes,

impl FromBytes for ExtCapabilitiesOctet1
where u8: FromBytes,

impl FromBytes for ExtCapabilitiesOctet2
where u8: FromBytes,

impl FromBytes for ExtCapabilitiesOctet3
where u8: FromBytes,

impl FromBytes for ExtendedChannelSwitchAnnouncement
where u8: FromBytes,

impl FromBytes for Header
where Id: FromBytes, u8: FromBytes,

impl FromBytes for HtCapabilities
where HtCapabilityInfo: FromBytes, AmpduParams: FromBytes, SupportedMcsSet: FromBytes, HtExtCapabilities: FromBytes, TxBfCapability: FromBytes, AselCapability: FromBytes,

impl FromBytes for HtCapabilityInfo
where u16: FromBytes,

impl FromBytes for HtExtCapabilities
where u16: FromBytes,

impl FromBytes for HtOpInfo
where [u8; 5]: FromBytes,

impl FromBytes for HtOperation
where u8: FromBytes, HtOpInfo: FromBytes, SupportedMcsSet: FromBytes,

impl FromBytes for Id
where u8: FromBytes,

impl FromBytes for IdleOptions
where u8: FromBytes,

impl FromBytes for MpmProtocol
where u16: FromBytes,

impl FromBytes for PerrDestinationFlags
where u8: FromBytes,

impl FromBytes for PerrDestinationHeader
where PerrDestinationFlags: FromBytes, MacAddr: FromBytes, u32: FromBytes,

impl FromBytes for PerrHeader
where u8: FromBytes,

impl FromBytes for PrepFlags
where u8: FromBytes,

impl FromBytes for PrepHeader
where PrepFlags: FromBytes, u8: FromBytes, MacAddr: FromBytes, u32: FromBytes,

impl FromBytes for PrepTail
where u32: FromBytes, MacAddr: FromBytes,

impl FromBytes for PreqFlags
where u8: FromBytes,

impl FromBytes for PreqHeader
where PreqFlags: FromBytes, u8: FromBytes, u32: FromBytes, MacAddr: FromBytes,

impl FromBytes for PreqMiddle
where u32: FromBytes, u8: FromBytes,

impl FromBytes for PreqPerTarget
where PreqPerTargetFlags: FromBytes, MacAddr: FromBytes, u32: FromBytes,

impl FromBytes for PreqPerTargetFlags
where u8: FromBytes,

impl FromBytes for RmEnabledCapabilities
where [u8; 5]: FromBytes,

impl FromBytes for SecChanOffset
where u8: FromBytes,

impl FromBytes for SupportedMcsSet
where u128: FromBytes,

impl FromBytes for SupportedRate
where u8: FromBytes,

impl FromBytes for TimHeader
where u8: FromBytes, BitmapControl: FromBytes,

impl FromBytes for TransmitPower
where u8: FromBytes,

impl FromBytes for TransmitPowerInfo
where u8: FromBytes,

impl FromBytes for TxBfCapability
where u32: FromBytes,

impl FromBytes for VhtCapabilities
where VhtCapabilitiesInfo: FromBytes, VhtMcsNssSet: FromBytes,

impl FromBytes for VhtCapabilitiesInfo
where u32: FromBytes,

impl FromBytes for VhtChannelBandwidth
where u8: FromBytes,

impl FromBytes for VhtMcsNssMap
where u16: FromBytes,

impl FromBytes for VhtMcsNssSet
where u64: FromBytes,

impl FromBytes for VhtOperation
where VhtChannelBandwidth: FromBytes, u8: FromBytes, VhtMcsNssMap: FromBytes,

impl FromBytes for WideBandwidthChannelSwitch
where VhtChannelBandwidth: FromBytes, u8: FromBytes,

impl FromBytes for WmmAcParams
where WmmAciAifsn: FromBytes, EcwMinMax: FromBytes, u16: FromBytes,

impl FromBytes for WmmAciAifsn
where u8: FromBytes,

impl FromBytes for WmmInfo
where u8: FromBytes,

impl FromBytes for WmmParam
where WmmInfo: FromBytes, u8: FromBytes, WmmAcParams: FromBytes,

impl FromBytes for AttributeHeader
where Id: FromBytes, BigEndianU16: FromBytes,

impl FromBytes for Id
where [u8; 2]: FromBytes,

impl FromBytes for WpsState
where u8: FromBytes,

impl FromBytes for ActionCategory
where u8: FromBytes,

impl FromBytes for ActionHdr
where ActionCategory: FromBytes,

impl FromBytes for AddbaReqHdr
where BlockAckAction: FromBytes, u8: FromBytes, BlockAckParameters: FromBytes, u16: FromBytes, BlockAckStartingSequenceControl: FromBytes,

impl FromBytes for AddbaRespHdr
where BlockAckAction: FromBytes, u8: FromBytes, StatusCode: FromBytes, BlockAckParameters: FromBytes, u16: FromBytes,

impl FromBytes for AmsduSubframeHdr
where MacAddr: FromBytes, BigEndianU16: FromBytes,

impl FromBytes for AssocReqHdr
where CapabilityInfo: FromBytes, u16: FromBytes,

impl FromBytes for AssocRespHdr
where CapabilityInfo: FromBytes, StatusCode: FromBytes, Aid: FromBytes,

impl FromBytes for AuthAlgorithmNumber
where u16: FromBytes,

impl FromBytes for AuthHdr
where AuthAlgorithmNumber: FromBytes, u16: FromBytes, StatusCode: FromBytes,

impl FromBytes for BeaconHdr
where u64: FromBytes, TimeUnit: FromBytes, CapabilityInfo: FromBytes,

impl FromBytes for BlockAckAction
where u8: FromBytes,

impl FromBytes for BlockAckParameters
where u16: FromBytes,

impl FromBytes for BlockAckPolicy
where u8: FromBytes,

impl FromBytes for BlockAckStartingSequenceControl
where u16: FromBytes,

impl FromBytes for CapabilityInfo
where u16: FromBytes,

impl FromBytes for DeauthHdr
where ReasonCode: FromBytes,

impl FromBytes for DelbaHdr
where BlockAckAction: FromBytes, DelbaParameters: FromBytes, ReasonCode: FromBytes,

impl FromBytes for DelbaParameters
where u16: FromBytes,

impl FromBytes for DisassocHdr
where ReasonCode: FromBytes,

impl FromBytes for EthernetIIHdr
where MacAddr: FromBytes, BigEndianU16: FromBytes,

impl FromBytes for FixedDataHdrFields
where FrameControl: FromBytes, u16: FromBytes, MacAddr: FromBytes, SequenceControl: FromBytes,

impl FromBytes for FrameControl
where u16: FromBytes,

impl FromBytes for HtControl
where u32: FromBytes,

impl FromBytes for LlcHdr
where u8: FromBytes, [u8; 3]: FromBytes, BigEndianU16: FromBytes,

impl FromBytes for MgmtHdr
where FrameControl: FromBytes, u16: FromBytes, MacAddr: FromBytes, SequenceControl: FromBytes,

impl FromBytes for ProbeRespHdr
where u64: FromBytes, TimeUnit: FromBytes, CapabilityInfo: FromBytes,

impl FromBytes for PsPoll
where u16: FromBytes, Bssid: FromBytes, MacAddr: FromBytes,

impl FromBytes for QosControl
where u16: FromBytes,

impl FromBytes for ReasonCode
where u16: FromBytes,

impl FromBytes for SequenceControl
where u16: FromBytes,

impl FromBytes for SpectrumMgmtAction
where u8: FromBytes,

impl FromBytes for StatusCode
where u16: FromBytes,

impl FromBytes for Oui
where [u8; 3]: FromBytes,

impl FromBytes for TimeUnit
where u16: FromBytes,

impl FromBytes for HandleCountInfo
where u32: FromBytes,

impl FromBytes for Koid
where zx_koid_t: FromBytes,

impl FromBytes for MapInfo
where Name: FromBytes, usize: FromBytes, zx_info_maps_type_t: FromBytes, InfoMapsTypeUnion: FromBytes,

impl FromBytes for MappingDetails
where VmarFlagsExtended: FromBytes, [PadByte; 4]: FromBytes, Koid: FromBytes, u64: FromBytes, usize: FromBytes,

impl FromBytes for MemStats
where u64: FromBytes,

impl FromBytes for MemStatsCompression
where u64: FromBytes, zx_duration_t: FromBytes, [u64; 8]: FromBytes,

impl FromBytes for MemStatsExtended
where u64: FromBytes,

impl FromBytes for MemoryStall
where zx_duration_t: FromBytes,

impl FromBytes for Name
where [u8; 32]: FromBytes,

impl FromBytes for PerCpuStats
where u32: FromBytes, zx_duration_t: FromBytes, u64: FromBytes,

impl FromBytes for ProcessHandleStats
where [u32; 64]: FromBytes,

impl FromBytes for ProcessInfo
where i64: FromBytes, zx_time_t: FromBytes, u32: FromBytes,

impl FromBytes for ResourceInfo
where u32: FromBytes, u64: FromBytes, usize: FromBytes, [u8; 32]: FromBytes,

impl FromBytes for Rights
where zx_rights_t: FromBytes,

impl FromBytes for TaskRuntimeInfo
where zx_duration_t: FromBytes,

impl FromBytes for TaskStatsInfo
where usize: FromBytes, u64: FromBytes,

impl FromBytes for VmarFlags
where zx_vm_option_t: FromBytes,

impl FromBytes for VmarFlagsExtended
where zx_vm_option_t: FromBytes,

impl FromBytes for VmarInfo
where usize: FromBytes,

impl FromBytes for VmoInfo
where Koid: FromBytes, Name: FromBytes, u64: FromBytes, usize: FromBytes, VmoInfoFlags: FromBytes, [PadByte; 4]: FromBytes, Rights: FromBytes, u32: FromBytes,

impl FromBytes for VmoInfoFlags
where u32: FromBytes,

impl FromBytes for PadByte
where u8: FromBytes,

impl FromBytes for priority_params
where i32: FromBytes, [PadByte; 20]: FromBytes,

impl FromBytes for zx_arm64_exc_data_t
where u32: FromBytes, [PadByte; 4]: FromBytes, u64: FromBytes, [PadByte; 8]: FromBytes,

impl FromBytes for zx_cpu_set_t
where [u64; 8]: FromBytes,

impl FromBytes for zx_exception_context_t
where zx_exception_header_arch_t: FromBytes, zx_excp_policy_code_t: FromBytes, u32: FromBytes,

impl FromBytes for zx_exception_header_t
where u32: FromBytes, zx_excp_type_t: FromBytes,

impl FromBytes for zx_exception_info_t
where zx_koid_t: FromBytes, zx_excp_type_t: FromBytes, [PadByte; 4]: FromBytes,

impl FromBytes for zx_exception_report_t
where zx_exception_header_t: FromBytes, zx_exception_context_t: FromBytes,

impl FromBytes for zx_info_cpu_stats_t
where u32: FromBytes, zx_duration_t: FromBytes, u64: FromBytes,

impl FromBytes for zx_info_handle_basic_t
where zx_koid_t: FromBytes, zx_rights_t: FromBytes, zx_obj_type_t: FromBytes, [PadByte; 4]: FromBytes,

impl FromBytes for zx_info_handle_count_t
where u32: FromBytes,

impl FromBytes for zx_info_job_t
where i64: FromBytes, u8: FromBytes,

impl FromBytes for zx_info_kmem_stats_compression_t
where u64: FromBytes, zx_duration_t: FromBytes, [u64; 8]: FromBytes,

impl FromBytes for zx_info_kmem_stats_extended_t
where u64: FromBytes,

impl FromBytes for zx_info_kmem_stats_t
where u64: FromBytes,

impl FromBytes for zx_info_maps_mapping_t
where zx_vm_option_t: FromBytes, [PadByte; 4]: FromBytes, zx_koid_t: FromBytes, u64: FromBytes, usize: FromBytes,

impl FromBytes for zx_info_maps_t
where [u8; 32]: FromBytes, zx_vaddr_t: FromBytes, usize: FromBytes, zx_info_maps_type_t: FromBytes, InfoMapsTypeUnion: FromBytes,

impl FromBytes for zx_info_memory_stall_t
where zx_duration_t: FromBytes,

impl FromBytes for zx_info_process_handle_stats_t
where [u32; 64]: FromBytes,

impl FromBytes for zx_info_process_t
where i64: FromBytes, zx_time_t: FromBytes, u32: FromBytes,

impl FromBytes for zx_info_resource_t
where u32: FromBytes, u64: FromBytes, usize: FromBytes, [u8; 32]: FromBytes,

impl FromBytes for zx_info_socket_t
where u32: FromBytes, usize: FromBytes,

impl FromBytes for zx_info_task_runtime_t
where zx_duration_t: FromBytes,

impl FromBytes for zx_info_task_stats_t
where usize: FromBytes, u64: FromBytes,

impl FromBytes for zx_info_thread_stats_t
where zx_duration_t: FromBytes, u32: FromBytes,

impl FromBytes for zx_info_thread_t
where zx_thread_state_t: FromBytes, u32: FromBytes, zx_cpu_set_t: FromBytes,

impl FromBytes for zx_info_vmar_t
where usize: FromBytes,

impl FromBytes for zx_info_vmo_t
where zx_koid_t: FromBytes, [u8; 32]: FromBytes, u64: FromBytes, usize: FromBytes, u32: FromBytes, [PadByte; 4]: FromBytes, zx_rights_t: FromBytes,

impl FromBytes for zx_log_record_t
where u64: FromBytes, [PadByte; 4]: FromBytes, u16: FromBytes, u8: FromBytes, zx_instant_boot_t: FromBytes, [u8; 216]: FromBytes,

impl FromBytes for zx_packet_guest_vcpu_exit_t
where i64: FromBytes, [PadByte; 8]: FromBytes,

impl FromBytes for zx_packet_guest_vcpu_interrupt_t
where u64: FromBytes, u8: FromBytes, [PadByte; 7]: FromBytes,

impl FromBytes for zx_packet_guest_vcpu_startup_t
where u64: FromBytes, zx_gpaddr_t: FromBytes,

impl FromBytes for zx_riscv64_exc_data_t
where u64: FromBytes, [PadByte; 8]: FromBytes,

impl FromBytes for zx_sched_deadline_params_t
where zx_duration_t: FromBytes,

impl FromBytes for zx_thread_state_general_regs_t
where u64: FromBytes,

impl FromBytes for zx_x86_64_exc_data_t
where u64: FromBytes,

impl FromBytes for InfoMapsTypeUnion
where zx_info_maps_mapping_t: FromBytes + Immutable,

impl FromBytes for zx_exception_header_arch_t
where zx_x86_64_exc_data_t: FromBytes + Immutable, zx_arm64_exc_data_t: FromBytes + Immutable, zx_riscv64_exc_data_t: FromBytes + Immutable,

impl FromBytes for zx_packet_guest_vcpu_union_t
where zx_packet_guest_vcpu_interrupt_t: FromBytes + Immutable, zx_packet_guest_vcpu_startup_t: FromBytes + Immutable, zx_packet_guest_vcpu_exit_t: FromBytes + Immutable,

impl FromBytes for zx_profile_info_union
where priority_params: FromBytes + Immutable, zx_sched_deadline_params_t: FromBytes + Immutable,