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 Freeze for Definition
impl RefUnwindSafe for Definition
impl Send for Definition
impl Sync for Definition
impl Unpin for Definition
impl UnwindSafe for Definition
Blanket Implementations§
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<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more