pub trait BorshSchema {
    // Required methods
    fn add_definitions_recursively(
        definitions: &mut HashMap<String, Definition>
    );
    fn declaration() -> String;

    // Provided methods
    fn add_definition(
        declaration: String,
        definition: Definition,
        definitions: &mut HashMap<String, Definition>
    ) { ... }
    fn schema_container() -> BorshSchemaContainer { ... }
}
Expand description

The declaration and the definition of the type that can be used to (de)serialize Borsh without the Rust type that produced it.

Required Methods§

fn add_definitions_recursively(definitions: &mut HashMap<String, Definition>)

Recursively, using DFS, add type definitions required for this type. For primitive types this is an empty map. Type definition explains how to serialize/deserialize a type.

fn declaration() -> String

Get the name of the type without brackets.

Provided Methods§

fn add_definition( declaration: String, definition: Definition, definitions: &mut HashMap<String, Definition> )

Helper method to add a single type definition to the map.

fn schema_container() -> BorshSchemaContainer

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl BorshSchema for bool

§

impl BorshSchema for f32

§

impl BorshSchema for f64

§

impl BorshSchema for i8

§

impl BorshSchema for i16

§

impl BorshSchema for i32

§

impl BorshSchema for i64

§

impl BorshSchema for i128

§

impl BorshSchema for isize

§

impl BorshSchema for str

§

impl BorshSchema for u8

§

impl BorshSchema for u16

§

impl BorshSchema for u32

§

impl BorshSchema for u64

§

impl BorshSchema for u128

§

impl BorshSchema for ()

§

impl BorshSchema for usize

§

impl BorshSchema for AssociatedTokenAccountInstruction

§

impl BorshSchema for Authorized

§

impl BorshSchema for Delegation

§

impl BorshSchema for Lockup

§

impl BorshSchema for Meta

§

impl BorshSchema for OptionalNonZeroPubkey

§

impl BorshSchema for PodU32
where [u8; 4]: BorshSchema,

§

impl BorshSchema for PodU64
where [u8; 8]: BorshSchema,

§

impl BorshSchema for Stake

§

impl BorshSchema for StakeFlags

§

impl BorshSchema for TokenMetadata
where OptionalNonZeroPubkey: BorshSchema, Pubkey: BorshSchema, String: BorshSchema, Vec<(String, String)>: BorshSchema,

§

impl<T0> BorshSchema for (T0,)
where T0: BorshSchema,

§

impl<T0, T1> BorshSchema for (T0, T1)
where T0: BorshSchema, T1: BorshSchema,

§

impl<T0, T1, T2> BorshSchema for (T0, T1, T2)
where T0: BorshSchema, T1: BorshSchema, T2: BorshSchema,

§

impl<T0, T1, T2, T3> BorshSchema for (T0, T1, T2, T3)

§

impl<T0, T1, T2, T3, T4> BorshSchema for (T0, T1, T2, T3, T4)

§

impl<T0, T1, T2, T3, T4, T5> BorshSchema for (T0, T1, T2, T3, T4, T5)

§

impl<T0, T1, T2, T3, T4, T5, T6> BorshSchema for (T0, T1, T2, T3, T4, T5, T6)

§

impl<T0, T1, T2, T3, T4, T5, T6, T7> BorshSchema for (T0, T1, T2, T3, T4, T5, T6, T7)

§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> BorshSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8)

§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> BorshSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)

§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> BorshSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> BorshSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> BorshSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)

§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> BorshSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)

§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> BorshSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)

§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> BorshSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> BorshSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16)

§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> BorshSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17)

§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> BorshSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18)

§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> BorshSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19)

§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> BorshSchema for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20)

§

impl<T> BorshSchema for Option<T>
where T: BorshSchema,

§

impl<T> BorshSchema for [T]
where T: BorshSchema,

§

impl<T, const N: usize> BorshSchema for [T; N]
where T: BorshSchema,

Implementors§

§

impl BorshSchema for Definition

§

impl BorshSchema for Fields

§

impl BorshSchema for Pubkey
where [u8; 32]: BorshSchema,

§

impl BorshSchema for String

§

impl BorshSchema for BorshSchemaContainer

§

impl<K, V> BorshSchema for HashMap<K, V>
where K: BorshSchema, V: BorshSchema,

§

impl<T> BorshSchema for Box<T>
where T: BorshSchema + ?Sized,

§

impl<T> BorshSchema for HashSet<T>
where T: BorshSchema,

§

impl<T> BorshSchema for Vec<T>
where T: BorshSchema,

§

impl<T, E> BorshSchema for Result<T, E>
where T: BorshSchema, E: BorshSchema,