pub trait DecodeField<'a>: Sized {
// Required method
fn decode_field(value: Option<&ValueRef<'a>>) -> Result<Self>;
}Expand description
Internal/public field decoder used by generated implementations.
Required Methods§
Sourcefn decode_field(value: Option<&ValueRef<'a>>) -> Result<Self>
fn decode_field(value: Option<&ValueRef<'a>>) -> Result<Self>
Decodes an optional map field into this field type. Returns an error when a required field is absent or has the wrong type.
§Examples
use libmaxminddb_rs::{DecodeField, ValueRef};
let value = ValueRef::Utf8("example");
let category = <&str>::decode_field(Some(&value))?;
assert_eq!(category, "example");Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".