Trait codec::number::NumberEncoder[][src]

pub trait NumberEncoder: BufferWriter {
    fn write_u8(&mut self, v: u8) -> Result<()> { ... }
fn write_u16(&mut self, v: u16) -> Result<()> { ... }
fn write_u32(&mut self, v: u32) -> Result<()> { ... }
fn write_u64(&mut self, v: u64) -> Result<()> { ... }
fn write_u64_desc(&mut self, v: u64) -> Result<()> { ... }
fn write_i64(&mut self, v: i64) -> Result<()> { ... }
fn write_i64_desc(&mut self, v: i64) -> Result<()> { ... }
fn write_f64(&mut self, v: f64) -> Result<()> { ... }
fn write_f64_desc(&mut self, v: f64) -> Result<()> { ... }
fn write_u16_le(&mut self, v: u16) -> Result<()> { ... }
fn write_u16_be(&mut self, v: u16) -> Result<()> { ... }
fn write_i16_le(&mut self, v: i16) -> Result<()> { ... }
fn write_u32_le(&mut self, v: u32) -> Result<()> { ... }
fn write_u32_be(&mut self, v: u32) -> Result<()> { ... }
fn write_i32_le(&mut self, v: i32) -> Result<()> { ... }
fn write_f32_le(&mut self, v: f32) -> Result<()> { ... }
fn write_u64_le(&mut self, v: u64) -> Result<()> { ... }
fn write_i64_le(&mut self, v: i64) -> Result<()> { ... }
fn write_f64_le(&mut self, v: f64) -> Result<()> { ... }
fn write_var_u64(&mut self, v: u64) -> Result<usize> { ... }
fn write_var_i64(&mut self, v: i64) -> Result<usize> { ... } }

Provided methods

fn write_u8(&mut self, v: u8) -> Result<()>[src]

Writes an unsigned 8 bit integer v, which is memory-comparable in ascending order.

Errors

Returns Error::Io if buffer remaining size < 1.

fn write_u16(&mut self, v: u16) -> Result<()>[src]

Writes an unsigned 16 bit integer v, which is memory-comparable in ascending order.

Errors

Returns Error::Io if buffer remaining size < 2.

fn write_u32(&mut self, v: u32) -> Result<()>[src]

Writes an unsigned 32 bit integer v, which is memory-comparable in ascending order.

Errors

Returns Error::Io if buffer remaining size < 4.

fn write_u64(&mut self, v: u64) -> Result<()>[src]

Writes an unsigned 64 bit integer v, which is memory-comparable in ascending order.

Errors

Returns Error::Io if buffer remaining size < 8.

fn write_u64_desc(&mut self, v: u64) -> Result<()>[src]

Writes an unsigned 64 bit integer v, which is memory-comparable in descending order.

Errors

Returns Error::Io if buffer remaining size < 8.

fn write_i64(&mut self, v: i64) -> Result<()>[src]

Writes a signed 64 bit integer v, which is memory-comparable in ascending order.

Errors

Returns Error::Io if buffer remaining size < 8.

fn write_i64_desc(&mut self, v: i64) -> Result<()>[src]

Writes a signed 64 bit integer v, which is memory-comparable in descending order.

Errors

Returns Error::Io if buffer remaining size < 8.

fn write_f64(&mut self, v: f64) -> Result<()>[src]

Writes a 64 bit float number v, which is memory-comparable in ascending order.

Errors

Returns Error::Io if buffer remaining size < 8.

fn write_f64_desc(&mut self, v: f64) -> Result<()>[src]

Writes a 64 bit float number v, which is memory-comparable in descending order.

Errors

Returns Error::Io if buffer remaining size < 8.

fn write_u16_le(&mut self, v: u16) -> Result<()>[src]

Writes an unsigned 16 bit integer v in little endian, which is not memory-comparable.

Errors

Returns Error::Io if buffer remaining size < 2.

fn write_u16_be(&mut self, v: u16) -> Result<()>[src]

Writes an unsigned 16 bit integer v in big endian, which is memory-comparable.

This function is an alias to write_u16.

fn write_i16_le(&mut self, v: i16) -> Result<()>[src]

Writes a signed 16 bit integer v in little endian, which is not memory-comparable.

Errors

Returns Error::Io if buffer remaining size < 2.

fn write_u32_le(&mut self, v: u32) -> Result<()>[src]

Writes an unsigned 32 bit integer v in little endian, which is not memory-comparable.

Errors

Returns Error::Io if buffer remaining size < 4.

fn write_u32_be(&mut self, v: u32) -> Result<()>[src]

Writes an unsigned 32 bit integer v in big endian, which is memory-comparable.

This function is an alias to write_u32.

fn write_i32_le(&mut self, v: i32) -> Result<()>[src]

Writes a signed 32 bit integer v in little endian, which is not memory-comparable.

Errors

Returns Error::Io if buffer remaining size < 4.

fn write_f32_le(&mut self, v: f32) -> Result<()>[src]

Writes a 32 bit float number v in little endian, which is not memory-comparable.

Errors

Returns Error::Io if buffer remaining size < 4.

fn write_u64_le(&mut self, v: u64) -> Result<()>[src]

Writes an unsigned 64 bit integer v in little endian, which is not memory-comparable.

Errors

Returns Error::Io if buffer remaining size < 8.

fn write_i64_le(&mut self, v: i64) -> Result<()>[src]

Writes a signed 64 bit integer v in little endian, which is not memory-comparable.

Errors

Returns Error::Io if buffer remaining size < 8.

fn write_f64_le(&mut self, v: f64) -> Result<()>[src]

Writes a 64 bit float number v in little endian, which is not memory-comparable.

Errors

Returns Error::Io if buffer remaining size < 8.

fn write_var_u64(&mut self, v: u64) -> Result<usize>[src]

Writes an unsigned 64 bit integer v in VarInt encoding, which is not memory-comparable. Returns the number of bytes that encoded.

Note:

  • VarInt encoding is slow, try avoid using it.
  • The buffer must reserve 10 bytes for writing, although actual written bytes may be less.
  • The buffer will be advanced by actual written bytes.

Errors

Returns Error::Io if buffer remaining size < 10.

fn write_var_i64(&mut self, v: i64) -> Result<usize>[src]

Writes a signed 64 bit integer v in VarInt encoding, which is not memory-comparable. Returns the number of bytes that encoded.

Note:

  • VarInt encoding is slow, try avoid using it.
  • The buffer must reserve 10 bytes for writing, although actual written bytes may be less.
  • The buffer will be advanced by actual written bytes.

Errors

Returns Error::Io if buffer remaining size < 10.

Loading content...

Implementors

impl<T: BufferWriter> NumberEncoder for T[src]

Any types who implemented BufferWriter also implements NumberEncoder.

Loading content...