[][src]Trait positioned_io_preview::WriteBytesAtExt

pub trait WriteBytesAtExt: WriteAt {
    fn write_u8_at(&mut self, pos: u64, n: u8) -> Result<()> { ... }
fn write_i8_at(&mut self, pos: u64, n: i8) -> Result<()> { ... }
fn write_u16_at<T: ByteOrder>(&mut self, pos: u64, n: u16) -> Result<()> { ... }
fn write_i16_at<T: ByteOrder>(&mut self, pos: u64, n: i16) -> Result<()> { ... }
fn write_u32_at<T: ByteOrder>(&mut self, pos: u64, n: u32) -> Result<()> { ... }
fn write_i32_at<T: ByteOrder>(&mut self, pos: u64, n: i32) -> Result<()> { ... }
fn write_u64_at<T: ByteOrder>(&mut self, pos: u64, n: u64) -> Result<()> { ... }
fn write_i64_at<T: ByteOrder>(&mut self, pos: u64, n: i64) -> Result<()> { ... }
fn write_uint_at<T: ByteOrder>(
        &mut self,
        pos: u64,
        n: u64,
        nbytes: usize
    ) -> Result<()> { ... }
fn write_int_at<T: ByteOrder>(
        &mut self,
        pos: u64,
        n: i64,
        nbytes: usize
    ) -> Result<()> { ... }
fn write_f32_at<T: ByteOrder>(&mut self, pos: u64, n: f32) -> Result<()> { ... }
fn write_f64_at<T: ByteOrder>(&mut self, pos: u64, n: f64) -> Result<()> { ... } }

Extends WriteAt with methods for writing numbers at offsets.

For most of these methods, you need to explicitly add a ByteOrder type parameter. Similar to byteorder::WriteBytesExt.

Examples

Write an integer to the middle of a byte array:

use byteorder::BigEndian;
use positioned_io::WriteBytesAtExt;

let mut buf = [0; 6];
buf.as_mut().write_u16_at::<BigEndian>(2, 300)?;
assert_eq!(buf, [0, 0, 1, 44, 0, 0]);

Provided Methods

Writes an unsigned 8-bit integer to an offset.

Writes a signed 8-bit integer to an offset.

Writes an unsigned 16-bit integer to an offset.

Writes a signed 16-bit integer to an offset.

Writes an unsigned 32-bit integer to an offset.

Writes a signed 32-bit integer to an offset.

Writes an unsigned 64-bit integer to an offset.

Writes a signed 64-bit integer to an offset.

Writes an unsigned nbytes-bit integer to an offset.

Writes a signed nbytes-bit integer to an offset.

Writes a single-precision floating point number to an offset.

Writes a double-precision floating point number to an offset.

Implementors

impl<W: WriteAt> WriteBytesAtExt for W
[src]