pub fn decode_field_name(field_id: &str) -> XRPLCoreResult<&str>
Expand description
Returns the field name represented by the given field ID.
See Field Ids:
<https://xrpl.org/serialization.html#field-ids>
§Examples
§Basic usage
use xrpl::core::binarycodec::utils::decode_field_name;
use xrpl::core::binarycodec::exceptions::XRPLBinaryCodecException;
use xrpl::core::exceptions::XRPLCoreException;
let field_id: &str = "26";
let field_name: &str = "LedgerSequence";
let decoding: Option<&str> = match decode_field_name(field_id) {
Ok(field_name) => Some(field_name),
Err(e) => match e {
XRPLCoreException::XRPLBinaryCodecError(XRPLBinaryCodecException::UnexpectedFieldIdByteRange {
min: _,
max: _
}) => None,
_ => None,
}
};
assert_eq!(Some(field_name), decoding);