Skip to main content

get_field_optional

Function get_field_optional 

Source
pub fn get_field_optional<T: FromLedger, const CODE: i32>(
    field: SField<T, CODE>,
) -> Result<Option<T>>
Expand description

Retrieves an optionally present field from the current ledger object.

ยงReturns

Returns a Result<Option<T>> where:

  • Ok(Some(T)) - The field value for the specified field
  • Ok(None) - If the field is not present (i.e., result_code == FIELD_NOT_FOUND)
  • Err(Error) - If the field cannot be retrieved, has unexpected size, or fails to decode