Expand description
§Current Ledger Object Field Retrieval Module (no slot)
Typed accessors for reading fields from the current ledger object — the ledger entry the
host is executing against — without first caching it into a slot. This is the no-slot
counterpart to crate::fields::ledger_obj. get_field and get_field_optional are generic
over any type implementing crate::fields::decoder::FromLedger — see
crate::fields::decoder for how a type opts into that.
§Optional vs Required Fields
- Required (
get_field): Returns an error if the field is missing. - Optional (
get_field_optional): ReturnsOk(None)if the field is missing.
Functions§
- get_
blob_ field - Retrieves a
Blob<N>field from the current ledger object, writing the host’s bytes directly into the returnedBlob<N>’s own storage. See the comment above this function for whyBlob<N>gets a dedicated accessor instead of usingget_field. - get_
blob_ field_ optional - Optional variant of
get_blob_field: returnsOk(None)if the field is not present, otherwise behaves identically (including the direct-write zero-copy behavior). Implemented in terms ofget_blob_fielditself rather than duplicating its body —Error::FieldNotFoundround-trips exactly throughError::from_code/.code()(both are justFIELD_NOT_FOUND), so translating that one error case intoNoneis all this needs to do. - get_
field - Retrieves a field from the current ledger object using an SField constant.
- get_
field_ optional - Retrieves an optionally present field from the current ledger object.