Trait obi::enc::OBIEncode[][src]

pub trait OBIEncode {
    fn encode<W: Write>(&self, writer: &mut W) -> Result<()>;

    fn try_to_vec(&self) -> Result<Vec<u8>> { ... }
fn is_u8() -> bool { ... } }

A data-structure that can be encoded into binary format by NBOR.

Required methods

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>[src]

Loading content...

Provided methods

fn try_to_vec(&self) -> Result<Vec<u8>>[src]

Encode this instance into a vector of bytes.

fn is_u8() -> bool[src]

Whether Self is u8. NOTE: Vec<u8> is the most common use-case for encode and decode, it’s worth handling it as a special case to improve performance. It’s a workaround for specific Vec<u8> implementation versus generic Vec<T> implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details.

Loading content...

Implementations on Foreign Types

impl OBIEncode for u8[src]

impl OBIEncode for i8[src]

impl OBIEncode for i16[src]

impl OBIEncode for i32[src]

impl OBIEncode for i64[src]

impl OBIEncode for i128[src]

impl OBIEncode for u16[src]

impl OBIEncode for u32[src]

impl OBIEncode for u64[src]

impl OBIEncode for u128[src]

impl OBIEncode for bool[src]

impl OBIEncode for String[src]

impl<T> OBIEncode for Vec<T> where
    T: OBIEncode
[src]

Loading content...

Implementors

Loading content...