Struct zerocopy::byteorder::I64 [−][src]
#[repr(transparent)]pub struct I64<O: ByteOrder>(_, _);
Expand description
A 64-bit signed integer
stored in O
byte order.
I64
is like the native i64
type with
two major differences: First, it has no alignment requirement (its alignment is 1).
Second, the endianness of its memory layout is given by the type parameter O
.
An I64
can be constructed using
the new
method, and its contained value can be obtained as a native
i64
using the get
method, or updated in place with
the set
method. In all cases, if the endianness O
is not the same as the
endianness of the current platform, an endianness swap will be performed in
order to uphold the invariants that a) the layout of I64
has endianness O
and that, b) the layout of i64
has
the platform’s native endianness.
I64
implements FromBytes
, AsBytes
, and Unaligned
,
making it useful for parsing and serialization. See the module documentation for an
example of how it can be used for parsing UDP packets.
Implementations
The value zero.
This constant should be preferred to constructing a new value
using new
, as new
may perform an endianness swap depending
on the endianness and platform.
Constructs a new value, possibly performing an endianness swap
to guarantee that the returned value has endianness O
.
Returns the value as a primitive type, possibly performing an endianness swap to guarantee that the return value has the endianness of the native platform.
Trait Implementations
Reads a copy of Self
from bytes
. Read more
Reads a copy of Self
from the prefix of bytes
. Read more
Reads a copy of Self
from the suffix of bytes
. Read more
Creates an instance of Self
from zeroed bytes.
Creates a Box<Self>
from zeroed bytes. Read more
Creates a Box<[Self]>
(a boxed slice) from zeroed bytes. Read more
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
Performs the conversion.
Auto Trait Implementations
impl<O> RefUnwindSafe for I64<O> where
O: RefUnwindSafe,
impl<O> UnwindSafe for I64<O> where
O: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more