Struct I64

Source
#[repr(C, align(8))]
pub struct I64(/* private fields */);
Expand description

A signed, 64-bit integer type with explicit alignment requirements

Without the explicit align representation hint, this type may have different alignment requirements on different machines. This helps to ensure that the type has a predictable layout in memory and that operations assuming a particular alignment value are sound.

Implementations§

Source§

impl I64

Source

pub const fn new(value: i64) -> Self

Creates a new I64 from a integer value.

§Endianness

The newly-created instance uses the target machines native endianness by default. To create this type with an explicitly-specified endianness, use one of the specialized constructor methods.

Source

pub const fn new_be(value: i64) -> Self

Creates a new I64 from a big endian integer value.

Source

pub const fn new_le(value: i64) -> Self

Creates a new I64 from an integer, interpreting it as little endian byte order

Source

pub const fn from_le_chunk(chunk: Chunk<8>) -> Self

Reads a new I64 in little endian byte order from a chunk of bytes with size 8

Source

pub const fn from_be_chunk(chunk: Chunk<8>) -> Self

Reads a new I64 in big endian byte order from a chunk of bytes with size 8

Source

pub const fn from_le_bytes(bytes: [u8; 8]) -> Self

Create a native endian integer value from its representation as a byte array in little endian.

Source

pub const fn from_be_bytes(bytes: [u8; 8]) -> Self

Create a native endian integer value from its representation as a byte array in big endian.

Source

pub const fn to_le_bytes(self) -> [u8; 8]

Return the memory representation of this integer as a byte array in little-endian byte order.

Source

pub const fn to_be_bytes(self) -> [u8; 8]

Return the memory representation of this integer as a byte array in little-endian byte order.

Source

pub const fn get(self, endian: Endian) -> i64

Get the i64 aligned integer in the the specified byte order.

Source

pub const fn get_ne(self) -> i64

Get the i64 aligned integer in native-endian byte order.

This method uses the target endian value, calculated at compile time, to determine which byte order serialization variant to use.

Source

pub const fn get_le(self) -> i64

Get the i64 aligned integer in little-endian byte order.

Source

pub const fn get_be(self) -> i64

Get the i64 aligned integer in big-endian byte order.

Source§

impl I64

Source

pub const fn read_aligned(bytes: &[u8], codec: Codec) -> Result<I64>

Reads an aligned I64 type from a slice of bytes using the specified endianness.

§Errors
§Errors

Methods from Deref<Target = i64>§

1.43.0 · Source

pub const MIN: i64 = -9_223_372_036_854_775_808i64

1.43.0 · Source

pub const MAX: i64 = 9_223_372_036_854_775_807i64

1.53.0 · Source

pub const BITS: u32 = 64u32

Trait Implementations§

Source§

impl Abi for I64

Source§

const ALIGN: usize = _

Returns the ABI-required minimum alignment of a type in bytes. Read more
Source§

const SIZE: usize = _

Returns the size of a type in bytes. Read more
Source§

const IS_ZST: bool = _

Returns true if this type is a ZST, with a size of zero bytes.
Source§

fn alignment(&self) -> usize

Returns the ABI-required minimum alignment of the type of the value that val points to in bytes. Read more
Source§

fn size(&self) -> usize

Returns the size of the pointed-to value in bytes at runtime. Read more
Source§

impl Binary for I64

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl BytesOf for I64

Source§

fn bytes_of(&self) -> &[u8]

Gets the raw bytes comprising the region of memory this type occupies.
Source§

impl Clone for I64

Source§

fn clone(&self) -> I64

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for I64

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for I64

Source§

fn default() -> I64

Returns the “default value” for a type. Read more
Source§

impl Deref for I64

Source§

type Target = i64

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Display for I64

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<I64> for i64

Source§

fn from(value: I64) -> i64

Converts to this type from the input type.
Source§

impl From<i64> for I64

Source§

fn from(value: i64) -> I64

Converts to this type from the input type.
Source§

impl Hash for I64

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Integer for I64

Source§

type Repr = i64

Inner representation of the Integer type.
Source§

fn is_zero(&self) -> bool

Returns true if this Integer type is equal to zero.
Source§

fn as_ptr(&self) -> *const Self

Get this Integer type as a raw pointer.
Source§

fn value(&self) -> Self::Repr

Gets the value of this instance at runtime.
Source§

impl LowerHex for I64

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Octal for I64

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Ord for I64

Source§

fn cmp(&self, other: &I64) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for I64

Source§

fn eq(&self, other: &I64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for I64

Source§

fn partial_cmp(&self, other: &I64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl UpperHex for I64

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Zeroable for I64

Source§

unsafe fn zero_memory() -> Self

Initializes this type as a contiguous region of memory represented by the all-zero byte pattern. Read more
Source§

impl Copy for I64

Source§

impl Eq for I64

Source§

impl StructuralPartialEq for I64

Auto Trait Implementations§

§

impl Freeze for I64

§

impl RefUnwindSafe for I64

§

impl Send for I64

§

impl Sync for I64

§

impl Unpin for I64

§

impl UnwindSafe for I64

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, const N: usize> Array<N> for T
where T: Abi + Integer + Zeroable,

Source§

fn from_ptr<A>(ptr: *const A) -> Result<T, Error>
where A: Abi,

Decodes a chunk of bytes into an ABI-compatible type. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.