Trait byteordered::Endian
source · pub trait Endian: Sealed {
Show 16 methods
fn read_i16<R>(&self, reader: R) -> IoResult<i16>
where
R: Read;
fn read_u16<R>(&self, reader: R) -> IoResult<u16>
where
R: Read;
fn read_i32<R>(&self, reader: R) -> IoResult<i32>
where
R: Read;
fn read_u32<R>(&self, reader: R) -> IoResult<u32>
where
R: Read;
fn read_i64<R>(&self, reader: R) -> IoResult<i64>
where
R: Read;
fn read_u64<R>(&self, reader: R) -> IoResult<u64>
where
R: Read;
fn read_f32<R>(&self, reader: R) -> IoResult<f32>
where
R: Read;
fn read_f64<R>(&self, reader: R) -> IoResult<f64>
where
R: Read;
fn write_i16<W>(&self, writer: W, v: i16) -> IoResult<()>
where
W: Write;
fn write_u16<W>(&self, writer: W, v: u16) -> IoResult<()>
where
W: Write;
fn write_i32<W>(&self, writer: W, v: i32) -> IoResult<()>
where
W: Write;
fn write_u32<W>(&self, writer: W, v: u32) -> IoResult<()>
where
W: Write;
fn write_i64<W>(&self, writer: W, v: i64) -> IoResult<()>
where
W: Write;
fn write_u64<W>(&self, writer: W, v: u64) -> IoResult<()>
where
W: Write;
fn write_f32<W>(&self, writer: W, v: f32) -> IoResult<()>
where
W: Write;
fn write_f64<W>(&self, writer: W, v: f64) -> IoResult<()>
where
W: Write;
}
Expand description
General trait for types that can serialize and deserialize bytes in some
byte order. It roughly resembles byteorder::ByteOrder
, with the
exception that it is implemented for material types. This makes it possible
to embed byte order information to a reader or writer by composition
(which is done by ByteOrdered
).
Required Methods
sourcefn read_i16<R>(&self, reader: R) -> IoResult<i16>where
R: Read,
fn read_i16<R>(&self, reader: R) -> IoResult<i16>where
R: Read,
Reads a signed 16 bit integer from the given reader.
Errors
This method returns the same errors as Read::read_exact
.
sourcefn read_u16<R>(&self, reader: R) -> IoResult<u16>where
R: Read,
fn read_u16<R>(&self, reader: R) -> IoResult<u16>where
R: Read,
Reads an unsigned 16 bit integer from the given reader.
Errors
This method returns the same errors as Read::read_exact
.
sourcefn read_i32<R>(&self, reader: R) -> IoResult<i32>where
R: Read,
fn read_i32<R>(&self, reader: R) -> IoResult<i32>where
R: Read,
Reads a signed 32 bit integer from the given reader.
Errors
This method returns the same errors as Read::read_exact
.
sourcefn read_u32<R>(&self, reader: R) -> IoResult<u32>where
R: Read,
fn read_u32<R>(&self, reader: R) -> IoResult<u32>where
R: Read,
Reads an unsigned 32 bit integer from the given reader.
Errors
This method returns the same errors as Read::read_exact
.
sourcefn read_i64<R>(&self, reader: R) -> IoResult<i64>where
R: Read,
fn read_i64<R>(&self, reader: R) -> IoResult<i64>where
R: Read,
Reads a signed 64 bit integer from the given reader.
Errors
This method returns the same errors as Read::read_exact
.
sourcefn read_u64<R>(&self, reader: R) -> IoResult<u64>where
R: Read,
fn read_u64<R>(&self, reader: R) -> IoResult<u64>where
R: Read,
Reads an unsigned 16 bit integer from the given reader.
Errors
This method returns the same errors as Read::read_exact
.
sourcefn read_f32<R>(&self, reader: R) -> IoResult<f32>where
R: Read,
fn read_f32<R>(&self, reader: R) -> IoResult<f32>where
R: Read,
Reads a IEEE754 single-precision (4 bytes) floating point number from the given reader.
Errors
This method returns the same errors as Read::read_exact
.
sourcefn read_f64<R>(&self, reader: R) -> IoResult<f64>where
R: Read,
fn read_f64<R>(&self, reader: R) -> IoResult<f64>where
R: Read,
Reads a IEEE754 double-precision (8 bytes) floating point number from the given reader.
Errors
This method returns the same errors as Read::read_exact
.
sourcefn write_i16<W>(&self, writer: W, v: i16) -> IoResult<()>where
W: Write,
fn write_i16<W>(&self, writer: W, v: i16) -> IoResult<()>where
W: Write,
Writes a signed 16 bit integer to the given writer.
Errors
This method returns the same errors as Write::write_all
.
sourcefn write_u16<W>(&self, writer: W, v: u16) -> IoResult<()>where
W: Write,
fn write_u16<W>(&self, writer: W, v: u16) -> IoResult<()>where
W: Write,
Writes an unsigned 16 bit integer to the given writer.
Errors
This method returns the same errors as Write::write_all
.
sourcefn write_i32<W>(&self, writer: W, v: i32) -> IoResult<()>where
W: Write,
fn write_i32<W>(&self, writer: W, v: i32) -> IoResult<()>where
W: Write,
Writes a signed 32 bit integer to the given writer.
Errors
This method returns the same errors as Write::write_all
.
sourcefn write_u32<W>(&self, writer: W, v: u32) -> IoResult<()>where
W: Write,
fn write_u32<W>(&self, writer: W, v: u32) -> IoResult<()>where
W: Write,
Writes an unsigned 32 bit integer to the given writer.
Errors
This method returns the same errors as Write::write_all
.
sourcefn write_i64<W>(&self, writer: W, v: i64) -> IoResult<()>where
W: Write,
fn write_i64<W>(&self, writer: W, v: i64) -> IoResult<()>where
W: Write,
Writes a signed 64 bit integer to the given writer.
Errors
This method returns the same errors as Write::write_all
.
sourcefn write_u64<W>(&self, writer: W, v: u64) -> IoResult<()>where
W: Write,
fn write_u64<W>(&self, writer: W, v: u64) -> IoResult<()>where
W: Write,
Writes an unsigned 64 bit integer to the given writer.
Errors
This method returns the same errors as Write::write_all
.