[][src]Trait gimli::Endianity

pub trait Endianity: Debug + Default + Clone + Copy + PartialEq + Eq {
    fn is_big_endian(self) -> bool;

    fn is_little_endian(self) -> bool { ... }
fn read_u16(self, buf: &[u8]) -> u16 { ... }
fn read_u32(self, buf: &[u8]) -> u32 { ... }
fn read_u64(self, buf: &[u8]) -> u64 { ... }
fn read_uint(&mut self, buf: &[u8]) -> u64 { ... }
fn read_i16(self, buf: &[u8]) -> i16 { ... }
fn read_i32(self, buf: &[u8]) -> i32 { ... }
fn read_i64(self, buf: &[u8]) -> i64 { ... }
fn read_f32(self, buf: &[u8]) -> f32 { ... }
fn read_f64(self, buf: &[u8]) -> f64 { ... }
fn write_u16(self, buf: &mut [u8], n: u16) { ... }
fn write_u32(self, buf: &mut [u8], n: u32) { ... }
fn write_u64(self, buf: &mut [u8], n: u64) { ... } }

A trait describing the endianity of some buffer.

Required methods

fn is_big_endian(self) -> bool

Return true for big endian byte order.

Loading content...

Provided methods

fn is_little_endian(self) -> bool

Return true for little endian byte order.

fn read_u16(self, buf: &[u8]) -> u16

Reads an unsigned 16 bit integer from buf.

Panics

Panics when buf.len() < 2.

fn read_u32(self, buf: &[u8]) -> u32

Reads an unsigned 32 bit integer from buf.

Panics

Panics when buf.len() < 4.

fn read_u64(self, buf: &[u8]) -> u64

Reads an unsigned 64 bit integer from buf.

Panics

Panics when buf.len() < 8.

fn read_uint(&mut self, buf: &[u8]) -> u64

Read an unsigned n-bytes integer u64.

Panics

Panics when buf.len() < 1 or buf.len() > 8.

fn read_i16(self, buf: &[u8]) -> i16

Reads a signed 16 bit integer from buf.

Panics

Panics when buf.len() < 2.

fn read_i32(self, buf: &[u8]) -> i32

Reads a signed 32 bit integer from buf.

Panics

Panics when buf.len() < 4.

fn read_i64(self, buf: &[u8]) -> i64

Reads a signed 64 bit integer from buf.

Panics

Panics when buf.len() < 8.

fn read_f32(self, buf: &[u8]) -> f32

Reads a 32 bit floating point number from buf.

Panics

Panics when buf.len() < 8.

fn read_f64(self, buf: &[u8]) -> f64

Reads a 32 bit floating point number from buf.

Panics

Panics when buf.len() < 8.

fn write_u16(self, buf: &mut [u8], n: u16)

Writes an unsigned 16 bit integer n to buf.

Panics

Panics when buf.len() < 2.

fn write_u32(self, buf: &mut [u8], n: u32)

Writes an unsigned 32 bit integer n to buf.

Panics

Panics when buf.len() < 4.

fn write_u64(self, buf: &mut [u8], n: u64)

Writes an unsigned 64 bit integer n to buf.

Panics

Panics when buf.len() < 8.

Loading content...

Implementors

impl Endianity for RunTimeEndian[src]

impl Endianity for BigEndian[src]

impl Endianity for LittleEndian[src]

Loading content...