WriteExt

Trait WriteExt 

Source
pub trait WriteExt {
Show 26 methods // Required methods fn write_u8(&mut self, value: u8) -> Result<()>; fn write_u16(&mut self, value: u16) -> Result<()>; fn write_u16_be(&mut self, value: u16) -> Result<()>; fn write_u32(&mut self, value: u32) -> Result<()>; fn write_u32_be(&mut self, value: u32) -> Result<()>; fn write_u64(&mut self, value: u64) -> Result<()>; fn write_u64_be(&mut self, value: u64) -> Result<()>; fn write_u128(&mut self, value: u128) -> Result<()>; fn write_u128_be(&mut self, value: u128) -> Result<()>; fn write_i8(&mut self, value: i8) -> Result<()>; fn write_i16(&mut self, value: i16) -> Result<()>; fn write_i16_be(&mut self, value: i16) -> Result<()>; fn write_i32(&mut self, value: i32) -> Result<()>; fn write_i32_be(&mut self, value: i32) -> Result<()>; fn write_i64(&mut self, value: i64) -> Result<()>; fn write_i64_be(&mut self, value: i64) -> Result<()>; fn write_i128(&mut self, value: i128) -> Result<()>; fn write_i128_be(&mut self, value: i128) -> Result<()>; fn write_f32(&mut self, value: f32) -> Result<()>; fn write_f32_be(&mut self, value: f32) -> Result<()>; fn write_f64(&mut self, value: f64) -> Result<()>; fn write_f64_be(&mut self, value: f64) -> Result<()>; fn write_cstring(&mut self, value: &CString) -> Result<()>; fn write_fstring( &mut self, data: &str, len: usize, encoding: Encoding, padding: u8, truncate: bool, ) -> Result<()>; fn write_struct<V: StructPack>( &mut self, value: &V, big: bool, encoding: Encoding, info: &Option<Box<dyn Any>>, ) -> Result<()>; fn write_from<R: Read + Seek>( &mut self, reader: &mut R, offset: u64, len: u64, ) -> Result<()>;
}
Expand description

A trait to help to write data to a writer.

Required Methods§

Source

fn write_u8(&mut self, value: u8) -> Result<()>

Writes a u8 to the writer.

Source

fn write_u16(&mut self, value: u16) -> Result<()>

Writes a u16 to the writer in little-endian order.

Source

fn write_u16_be(&mut self, value: u16) -> Result<()>

Writes a u16 to the writer in big-endian order.

Source

fn write_u32(&mut self, value: u32) -> Result<()>

Writes a u32 to the writer in little-endian order.

Source

fn write_u32_be(&mut self, value: u32) -> Result<()>

Writes a u32 to the writer in big-endian order.

Source

fn write_u64(&mut self, value: u64) -> Result<()>

Writes a u64 to the writer in little-endian order.

Source

fn write_u64_be(&mut self, value: u64) -> Result<()>

Writes a u64 to the writer in big-endian order.

Source

fn write_u128(&mut self, value: u128) -> Result<()>

Writes a u128 to the writer in little-endian order.

Source

fn write_u128_be(&mut self, value: u128) -> Result<()>

Writes a u128 to the writer in big-endian order.

Source

fn write_i8(&mut self, value: i8) -> Result<()>

Writes an i8 to the writer.

Source

fn write_i16(&mut self, value: i16) -> Result<()>

Writes an i16 to the writer in little-endian order.

Source

fn write_i16_be(&mut self, value: i16) -> Result<()>

Writes an i16 to the writer in big-endian order.

Source

fn write_i32(&mut self, value: i32) -> Result<()>

Writes an i32 to the writer in little-endian order.

Source

fn write_i32_be(&mut self, value: i32) -> Result<()>

Writes an i32 to the writer in big-endian order.

Source

fn write_i64(&mut self, value: i64) -> Result<()>

Writes an i64 to the writer in little-endian order.

Source

fn write_i64_be(&mut self, value: i64) -> Result<()>

Writes an i64 to the writer in big-endian order.

Source

fn write_i128(&mut self, value: i128) -> Result<()>

Writes an i128 to the writer in little-endian order.

Source

fn write_i128_be(&mut self, value: i128) -> Result<()>

Writes an i128 to the writer in big-endian order.

Source

fn write_f32(&mut self, value: f32) -> Result<()>

Writes a f32 to the writer in little-endian order.

Source

fn write_f32_be(&mut self, value: f32) -> Result<()>

Writes a f32 to the writer in big-endian order.

Source

fn write_f64(&mut self, value: f64) -> Result<()>

Writes a f64 to the writer in little-endian order.

Source

fn write_f64_be(&mut self, value: f64) -> Result<()>

Writes a f64 to the writer in big-endian order.

Source

fn write_cstring(&mut self, value: &CString) -> Result<()>

Writes a C-style string (null-terminated) to the writer.

Source

fn write_fstring( &mut self, data: &str, len: usize, encoding: Encoding, padding: u8, truncate: bool, ) -> Result<()>

Writes a C-style string (null-terminated) from the reader with maximum length.

  • data is the string data to write.
  • len is the maximum length of the string to write. If the string is longer, it will be truncated if truncate is true otherwise an error is returned.
  • encoding specifies the encoding to use for the string.
  • padding indicates how to pad the string if it’s shorter than len.
  • truncate indicates whether to truncate the string if it’s longer than len.
Source

fn write_struct<V: StructPack>( &mut self, value: &V, big: bool, encoding: Encoding, info: &Option<Box<dyn Any>>, ) -> Result<()>

Write a struct to the writer.

Source

fn write_from<R: Read + Seek>( &mut self, reader: &mut R, offset: u64, len: u64, ) -> Result<()>

Writes data from a reader to the writer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: Write> WriteExt for T