Writer

Struct Writer 

Source
pub struct Writer<'a>(/* private fields */);
Expand description

Writer that writes to a slice of bytes

Implementations§

Source§

impl<'a> Writer<'a>

Source

pub fn new(buffer: &'a mut [u8]) -> Self

Create a new Writer into the provided growable buffer.

Trait Implementations§

Source§

impl<'a> Debug for Writer<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Write for Writer<'_>

Source§

fn remaining(&self) -> Option<usize>

Return the number of bytes remaining in this writer, or None if infinite.
Source§

fn take(&mut self, len: usize) -> FullResult<Self>

Write a number of bytes as a new writer. Read more
Source§

fn bytes(&mut self, bytes: impl AsRef<[u8]>) -> FullResult

Write out raw bytes.
Source§

fn str(&mut self, string: impl AsRef<str>) -> FullResult

Write out a UTF-8 string slice (does not include length).
Source§

fn u8(&mut self, byte: u8) -> FullResult

Write out a byte
Source§

fn i8(&mut self, byte: i8) -> FullResult

Write out a signed byte
Source§

fn uleb128<T: UInt>(&mut self, value: T) -> FullResult

Write out value in ULEB128 encoding.
Source§

fn end(&self) -> EndResult

Return Ok if end of buffer.

Auto Trait Implementations§

§

impl<'a> Freeze for Writer<'a>

§

impl<'a> RefUnwindSafe for Writer<'a>

§

impl<'a> Send for Writer<'a>

§

impl<'a> Sync for Writer<'a>

§

impl<'a> Unpin for Writer<'a>

§

impl<'a> !UnwindSafe for Writer<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T_traitful_extend__> Write for T_traitful_extend__
where T_traitful_extend__: Write,

Source§

fn u16(&mut self, int: u16) -> Result<(), FullError>

Write out a big endian encoded 2-byte unsigned integer.
Source§

fn u32(&mut self, int: u32) -> Result<(), FullError>

Write out a big endian encoded 4-byte unsigned integer.
Source§

fn u64(&mut self, int: u64) -> Result<(), FullError>

Write out a big endian encoded 8-byte unsigned integer.
Source§

fn u128(&mut self, int: u128) -> Result<(), FullError>

Write out a big endian encoded 16-byte unsigned integer.
Source§

fn i16(&mut self, int: i16) -> Result<(), FullError>

Write out a big endian encoded 2-byte signed integer.
Source§

fn i32(&mut self, int: i32) -> Result<(), FullError>

Write out a big endian encoded 4-byte signed integer.
Source§

fn i64(&mut self, int: i64) -> Result<(), FullError>

Write out a big endian encoded 8-byte signed integer.
Source§

fn i128(&mut self, int: i128) -> Result<(), FullError>

Write out a big endian encoded 16-byte signed integer.
Source§

fn f32(&mut self, float: f32) -> Result<(), FullError>

Write out a big endian encoded 32-bit float.
Source§

fn f64(&mut self, float: f64) -> Result<(), FullError>

Write out a big endian encoded 64-bit float.
Source§

impl<T_traitful_extend__> Write for T_traitful_extend__
where T_traitful_extend__: Write,

Source§

fn u16(&mut self, int: u16) -> Result<(), FullError>

Write out a little endian encoded 2-byte unsigned integer.
Source§

fn u32(&mut self, int: u32) -> Result<(), FullError>

Write out a little endian encoded 4-byte unsigned integer.
Source§

fn u64(&mut self, int: u64) -> Result<(), FullError>

Write out a little endian encoded 8-byte unsigned integer.
Source§

fn u128(&mut self, int: u128) -> Result<(), FullError>

Write out a little endian encoded 16-byte unsigned integer.
Source§

fn i16(&mut self, int: i16) -> Result<(), FullError>

Write out a little endian encoded 2-byte signed integer.
Source§

fn i32(&mut self, int: i32) -> Result<(), FullError>

Write out a little endian encoded 4-byte signed integer.
Source§

fn i64(&mut self, int: i64) -> Result<(), FullError>

Write out a little endian encoded 8-byte signed integer.
Source§

fn i128(&mut self, int: i128) -> Result<(), FullError>

Write out a little endian encoded 16-byte signed integer.
Source§

fn f32(&mut self, float: f32) -> Result<(), FullError>

Write out a little endian encoded 32-bit float.
Source§

fn f64(&mut self, float: f64) -> Result<(), FullError>

Write out a little endian encoded 64-bit float.