Class: Solace::Serializers::InstructionDeserializer
- Inherits:
-
BaseDeserializer
- Object
- Base
- BaseDeserializer
- Solace::Serializers::InstructionDeserializer
- Defined in:
- lib/solace/serializers/instruction_deserializer.rb
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
Methods inherited from Base
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)]
44 45 46 47 |
# File 'lib/solace/serializers/instruction_deserializer.rb', line 44 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)]
56 57 58 59 |
# File 'lib/solace/serializers/instruction_deserializer.rb', line 56 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)]
33 34 35 |
# File 'lib/solace/serializers/instruction_deserializer.rb', line 33 def next_extract_program_index record.program_index = io.read(1).ord end |