Trait borsh::ser::BorshSerialize[][src]

pub trait BorshSerialize {
    fn serialize<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 serialized into binary format by NBOR.

Required methods

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

Loading content...

Provided methods

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

Serialize 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 serialization and deserialization, 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 BorshSerialize for u8[src]

impl BorshSerialize for i8[src]

impl BorshSerialize for i16[src]

impl BorshSerialize for i32[src]

impl BorshSerialize for i64[src]

impl BorshSerialize for i128[src]

impl BorshSerialize for u16[src]

impl BorshSerialize for u32[src]

impl BorshSerialize for u64[src]

impl BorshSerialize for u128[src]

impl BorshSerialize for usize[src]

impl BorshSerialize for f32[src]

impl BorshSerialize for f64[src]

impl BorshSerialize for bool[src]

impl<T> BorshSerialize for Option<T> where
    T: BorshSerialize
[src]

impl<T, E> BorshSerialize for Result<T, E> where
    T: BorshSerialize,
    E: BorshSerialize
[src]

impl BorshSerialize for str[src]

impl<T> BorshSerialize for [T] where
    T: BorshSerialize
[src]

impl<T: BorshSerialize + ?Sized> BorshSerialize for &T[src]

impl BorshSerialize for SocketAddr[src]

impl BorshSerialize for SocketAddrV4[src]

impl BorshSerialize for SocketAddrV6[src]

impl BorshSerialize for Ipv4Addr[src]

impl BorshSerialize for Ipv6Addr[src]

impl<T> BorshSerialize for [T; 0] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 1] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 2] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 3] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 4] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 5] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 6] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 7] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 8] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 9] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 10] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 11] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 12] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 13] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 14] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 15] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 16] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 17] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 18] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 19] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 20] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 21] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 22] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 23] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 24] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 25] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 26] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 27] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 28] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 29] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 30] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 31] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 32] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 64] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 65] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 128] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 256] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 512] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 1024] where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for [T; 2048] where
    T: BorshSerialize
[src]

impl BorshSerialize for ()[src]

impl<T0, T1> BorshSerialize for (T0, T1) where
    T0: BorshSerialize,
    T1: BorshSerialize
[src]

impl<T0, T1, T2> BorshSerialize for (T0, T1, T2) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize
[src]

impl<T0, T1, T2, T3> BorshSerialize for (T0, T1, T2, T3) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4> BorshSerialize for (T0, T1, T2, T3, T4) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5> BorshSerialize for (T0, T1, T2, T3, T4, T5) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5, T6> BorshSerialize for (T0, T1, T2, T3, T4, T5, T6) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize,
    T6: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5, T6, T7> BorshSerialize for (T0, T1, T2, T3, T4, T5, T6, T7) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize,
    T6: BorshSerialize,
    T7: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> BorshSerialize for (T0, T1, T2, T3, T4, T5, T6, T7, T8) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize,
    T6: BorshSerialize,
    T7: BorshSerialize,
    T8: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> BorshSerialize for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize,
    T6: BorshSerialize,
    T7: BorshSerialize,
    T8: BorshSerialize,
    T9: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> BorshSerialize for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize,
    T6: BorshSerialize,
    T7: BorshSerialize,
    T8: BorshSerialize,
    T9: BorshSerialize,
    T10: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> BorshSerialize for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize,
    T6: BorshSerialize,
    T7: BorshSerialize,
    T8: BorshSerialize,
    T9: BorshSerialize,
    T10: BorshSerialize,
    T11: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> BorshSerialize for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize,
    T6: BorshSerialize,
    T7: BorshSerialize,
    T8: BorshSerialize,
    T9: BorshSerialize,
    T10: BorshSerialize,
    T11: BorshSerialize,
    T12: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> BorshSerialize for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize,
    T6: BorshSerialize,
    T7: BorshSerialize,
    T8: BorshSerialize,
    T9: BorshSerialize,
    T10: BorshSerialize,
    T11: BorshSerialize,
    T12: BorshSerialize,
    T13: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> BorshSerialize for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize,
    T6: BorshSerialize,
    T7: BorshSerialize,
    T8: BorshSerialize,
    T9: BorshSerialize,
    T10: BorshSerialize,
    T11: BorshSerialize,
    T12: BorshSerialize,
    T13: BorshSerialize,
    T14: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> BorshSerialize for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize,
    T6: BorshSerialize,
    T7: BorshSerialize,
    T8: BorshSerialize,
    T9: BorshSerialize,
    T10: BorshSerialize,
    T11: BorshSerialize,
    T12: BorshSerialize,
    T13: BorshSerialize,
    T14: BorshSerialize,
    T15: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> BorshSerialize for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize,
    T6: BorshSerialize,
    T7: BorshSerialize,
    T8: BorshSerialize,
    T9: BorshSerialize,
    T10: BorshSerialize,
    T11: BorshSerialize,
    T12: BorshSerialize,
    T13: BorshSerialize,
    T14: BorshSerialize,
    T15: BorshSerialize,
    T16: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> BorshSerialize for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize,
    T6: BorshSerialize,
    T7: BorshSerialize,
    T8: BorshSerialize,
    T9: BorshSerialize,
    T10: BorshSerialize,
    T11: BorshSerialize,
    T12: BorshSerialize,
    T13: BorshSerialize,
    T14: BorshSerialize,
    T15: BorshSerialize,
    T16: BorshSerialize,
    T17: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> BorshSerialize for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize,
    T6: BorshSerialize,
    T7: BorshSerialize,
    T8: BorshSerialize,
    T9: BorshSerialize,
    T10: BorshSerialize,
    T11: BorshSerialize,
    T12: BorshSerialize,
    T13: BorshSerialize,
    T14: BorshSerialize,
    T15: BorshSerialize,
    T16: BorshSerialize,
    T17: BorshSerialize,
    T18: BorshSerialize
[src]

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> BorshSerialize for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19) where
    T0: BorshSerialize,
    T1: BorshSerialize,
    T2: BorshSerialize,
    T3: BorshSerialize,
    T4: BorshSerialize,
    T5: BorshSerialize,
    T6: BorshSerialize,
    T7: BorshSerialize,
    T8: BorshSerialize,
    T9: BorshSerialize,
    T10: BorshSerialize,
    T11: BorshSerialize,
    T12: BorshSerialize,
    T13: BorshSerialize,
    T14: BorshSerialize,
    T15: BorshSerialize,
    T16: BorshSerialize,
    T17: BorshSerialize,
    T18: BorshSerialize,
    T19: BorshSerialize
[src]

Loading content...

Implementors

impl BorshSerialize for Definition where
    u32: BorshSerialize,
    Declaration: BorshSerialize,
    Declaration: BorshSerialize,
    Vec<Declaration>: BorshSerialize,
    Vec<(VariantName, Declaration)>: BorshSerialize,
    Fields: BorshSerialize
[src]

impl BorshSerialize for Fields where
    Vec<(FieldName, Declaration)>: BorshSerialize,
    Vec<Declaration>: BorshSerialize
[src]

impl BorshSerialize for String[src]

impl BorshSerialize for BorshSchemaContainer where
    Declaration: BorshSerialize,
    HashMap<Declaration, Definition>: BorshSerialize
[src]

impl<K, V> BorshSerialize for BTreeMap<K, V> where
    K: BorshSerialize,
    V: BorshSerialize
[src]

impl<K, V> BorshSerialize for HashMap<K, V> where
    K: BorshSerialize + PartialOrd,
    V: BorshSerialize
[src]

impl<T> BorshSerialize for BTreeSet<T> where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for BinaryHeap<T> where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for HashSet<T> where
    T: BorshSerialize + PartialOrd
[src]

impl<T> BorshSerialize for LinkedList<T> where
    T: BorshSerialize
[src]

impl<T> BorshSerialize for VecDeque<T> where
    T: BorshSerialize
[src]

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

impl<T: BorshSerialize + ?Sized> BorshSerialize for Box<T>[src]

impl<T: ?Sized> BorshSerialize for Cow<'_, T> where
    T: BorshSerialize + ToOwned
[src]

Loading content...