Class: Solace::Serializers::InstructionDeserializer
- Inherits:
-
BaseDeserializer
- Object
- BaseDeserializer
- Solace::Serializers::InstructionDeserializer
- Defined in:
- lib/solace/serializers/instruction_deserializer.rb
Overview
Deserializes a binary instruction into a Solace::Instruction object.
Instance Attribute Summary
Attributes inherited from BaseDeserializer
Instance Method Summary collapse
-
#next_extract_accounts ⇒ Array
Extracts the accounts from the instruction.
-
#next_extract_data ⇒ Array
Extracts the instruction data from the instruction.
-
#next_extract_program_index ⇒ Integer
Extracts the program index from the instruction.
Methods inherited from BaseDeserializer
Constructor Details
This class inherits a constructor from Solace::Serializers::BaseDeserializer
Instance Method Details
#next_extract_accounts ⇒ Array
Extracts the accounts from the instruction
The BufferLayout is:
- [Number of accounts (compact u16)]
- [Accounts (variable length u8)]
42 43 44 45 |
# File 'lib/solace/serializers/instruction_deserializer.rb', line 42 def next_extract_accounts length, = Codecs.decode_compact_u16(io) record.accounts = io.read(length).unpack('C*') end |
#next_extract_data ⇒ Array
Extracts the instruction data from the instruction
The BufferLayout is:
- [Number of data bytes (compact u16)]
- [Data bytes (variable length u8)]
54 55 56 57 |
# File 'lib/solace/serializers/instruction_deserializer.rb', line 54 def next_extract_data length, = Codecs.decode_compact_u16(io) record.data = io.read(length).unpack('C*') end |
#next_extract_program_index ⇒ Integer
Extracts the program index from the instruction
The BufferLayout is:
- [Program index (1 byte)]
31 32 33 |
# File 'lib/solace/serializers/instruction_deserializer.rb', line 31 def next_extract_program_index record.program_index = io.read(1).ord end |