pub struct DecoderRegistry { /* private fields */ }Expand description
Registry of instruction decoders
Implementations§
Source§impl DecoderRegistry
impl DecoderRegistry
Sourcepub fn register(&mut self, decoder: Box<dyn InstructionDecoder>)
pub fn register(&mut self, decoder: Box<dyn InstructionDecoder>)
Register a custom decoder
Sourcepub fn register_all(&mut self, decoders: Vec<Box<dyn InstructionDecoder>>)
pub fn register_all(&mut self, decoders: Vec<Box<dyn InstructionDecoder>>)
Register multiple decoders from a Vec
Sourcepub fn decode(
&self,
program_id: &Pubkey,
data: &[u8],
accounts: &[AccountMeta],
) -> Option<(DecodedInstruction, &dyn InstructionDecoder)>
pub fn decode( &self, program_id: &Pubkey, data: &[u8], accounts: &[AccountMeta], ) -> Option<(DecodedInstruction, &dyn InstructionDecoder)>
Decode an instruction using registered decoders
Sourcepub fn get_decoder(
&self,
program_id: &Pubkey,
) -> Option<&dyn InstructionDecoder>
pub fn get_decoder( &self, program_id: &Pubkey, ) -> Option<&dyn InstructionDecoder>
Get a decoder by program ID
Sourcepub fn has_decoder(&self, program_id: &Pubkey) -> bool
pub fn has_decoder(&self, program_id: &Pubkey) -> bool
Check if a decoder exists for a program ID
Trait Implementations§
Source§impl Debug for DecoderRegistry
impl Debug for DecoderRegistry
Auto Trait Implementations§
impl Freeze for DecoderRegistry
impl !RefUnwindSafe for DecoderRegistry
impl Send for DecoderRegistry
impl Sync for DecoderRegistry
impl Unpin for DecoderRegistry
impl !UnwindSafe for DecoderRegistry
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
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