Skip to main content

Module decoder

Module decoder 

Source
Expand description

Context-independent decode logic for typed field values.

Reading a field always looks the same: call a host function into a buffer, then turn the bytes it wrote into a typed value. FieldDecoder captures only that second step, so a type implements it once regardless of how many contexts (current transaction, ledger object, …) can produce those bytes. The marker traits below record which contexts are valid for a given type at compile time; the context-specific get_field functions (see crate::fields::current_tx, crate::fields::ledger_obj) require the matching marker.

Traits§

FieldDecoder
Decodes a typed value from the raw bytes a host function wrote.
FromCurrentTx
Marker: this type can be read from the current transaction via crate::fields::current_tx.
FromLedger
Marker: this type can be read from a ledger object via crate::fields::ledger_obj.