Enum switchboard_solana::prelude::borsh::schema::Definition
pub enum Definition {
Array {
length: u32,
elements: String,
},
Sequence {
elements: String,
},
Tuple {
elements: Vec<String>,
},
Enum {
variants: Vec<(String, String)>,
},
Struct {
fields: Fields,
},
}
Expand description
The type that we use to represent the definition of the Borsh type.
Variants§
Array
A fixed-size array with the length known at the compile time and the same-type elements.
Sequence
A sequence of elements of length known at the run time and the same-type elements.
Tuple
A fixed-size tuple with the length known at the compile time and the elements of different types.
Enum
A tagged union, a.k.a enum. Tagged-unions have variants with associated structures.
Struct
A structure, structurally similar to a tuple.
Trait Implementations§
§impl BorshDeserialize for Definitionwhere
u32: BorshDeserialize,
String: BorshDeserialize,
Vec<String>: BorshDeserialize,
Vec<(String, String)>: BorshDeserialize,
Fields: BorshDeserialize,
impl BorshDeserialize for Definitionwhere
u32: BorshDeserialize,
String: BorshDeserialize,
Vec<String>: BorshDeserialize,
Vec<(String, String)>: BorshDeserialize,
Fields: BorshDeserialize,
fn deserialize_reader<R>(reader: &mut R) -> Result<Definition, Error>where
R: Read,
§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
§impl BorshSerialize for Definitionwhere
u32: BorshSerialize,
String: BorshSerialize,
Vec<String>: BorshSerialize,
Vec<(String, String)>: BorshSerialize,
Fields: BorshSerialize,
impl BorshSerialize for Definitionwhere
u32: BorshSerialize,
String: BorshSerialize,
Vec<String>: BorshSerialize,
Vec<(String, String)>: BorshSerialize,
Fields: BorshSerialize,
§impl BorshSchema for Definition
impl BorshSchema for Definition
§fn declaration() -> String
fn declaration() -> String
Get the name of the type without brackets.
§fn add_definitions_recursively(definitions: &mut HashMap<String, Definition>)
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 add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition>
)
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
§impl Clone for Definition
impl Clone for Definition
§fn clone(&self) -> Definition
fn clone(&self) -> Definition
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for Definition
impl Debug for Definition
§impl EnumExt for Definitionwhere
u32: BorshDeserialize,
String: BorshDeserialize,
Vec<String>: BorshDeserialize,
Vec<(String, String)>: BorshDeserialize,
Fields: BorshDeserialize,
impl EnumExt for Definitionwhere
u32: BorshDeserialize,
String: BorshDeserialize,
Vec<String>: BorshDeserialize,
Vec<(String, String)>: BorshDeserialize,
Fields: BorshDeserialize,
§fn deserialize_variant<R>(
reader: &mut R,
variant_idx: u8
) -> Result<Definition, Error>where
R: Read,
fn deserialize_variant<R>(
reader: &mut R,
variant_idx: u8
) -> Result<Definition, Error>where
R: Read,
Deserialises given variant of an enum from the reader. Read more
§impl PartialEq for Definition
impl PartialEq for Definition
§fn eq(&self, other: &Definition) -> bool
fn eq(&self, other: &Definition) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for Definition
impl StructuralPartialEq for Definition
Auto Trait Implementations§
impl RefUnwindSafe for Definition
impl Send for Definition
impl Sync for Definition
impl Unpin for Definition
impl UnwindSafe for Definition
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.