Struct grin_core::ser::BinWriter[][src]

pub struct BinWriter<'a> { /* fields omitted */ }

Utility wrapper for an underlying byte Writer. Defines higher level methods to write numbers, byte vectors, hashes, etc.

Implementations

impl<'a> BinWriter<'a>[src]

pub fn new(sink: &'a mut dyn Write, version: ProtocolVersion) -> BinWriter<'a>[src]

Wraps a standard Write in a new BinWriter

pub fn default(sink: &'a mut dyn Write) -> BinWriter<'a>[src]

Constructor for BinWriter with default “local” protocol version.

Trait Implementations

impl<'a> Writer for BinWriter<'a>[src]

fn serialization_mode(&self) -> SerializationMode[src]

The mode this serializer is writing in

fn write_fixed_bytes<T: AsRef<[u8]>>(&mut self, bytes: T) -> Result<(), Error>[src]

Writes a fixed number of bytes. The reader is expected to know the actual length on read.

fn protocol_version(&self) -> ProtocolVersion[src]

Protocol version for version specific serialization rules.

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

Writes a u8 as bytes

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

Writes a u16 as bytes

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

Writes a u32 as bytes

fn write_i32(&mut self, n: i32) -> Result<(), Error>[src]

Writes a u32 as bytes

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

Writes a u64 as bytes

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

Writes a i64 as bytes

fn write_bytes<T: AsRef<[u8]>>(&mut self, bytes: T) -> Result<(), Error>[src]

Writes a variable number of bytes. The length is encoded as a 64-bit prefix. Read more

fn write_empty_bytes(&mut self, length: usize) -> Result<(), Error>[src]

Writes a fixed length of “empty” bytes.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for BinWriter<'a>

impl<'a> !Send for BinWriter<'a>

impl<'a> !Sync for BinWriter<'a>

impl<'a> Unpin for BinWriter<'a>

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T> UnsafeAny for T where
    T: Any