pub struct FieldMetadata { /* private fields */ }
Expand description
Literal metadata
Stores metadata associated with a literal expressions
and is designed to be fast to clone
.
This structure is used to store metadata associated with a literal expression, and it
corresponds to the metadata
field on Field
.
§Example: Create FieldMetadata
from a Field
// Create a new `FieldMetadata` instance from a `Field`
let metadata = FieldMetadata::new_from_field(&field);
// There is also a `From` impl:
let metadata = FieldMetadata::from(&field);
§Example: Update a Field
with FieldMetadata
// Add any metadata from `FieldMetadata` to `Field`
let updated_field = metadata.add_to_field(field);
Implementations§
Source§impl FieldMetadata
impl FieldMetadata
Sourcepub fn merge_options(
m: Option<&FieldMetadata>,
n: Option<&FieldMetadata>,
) -> Option<FieldMetadata>
pub fn merge_options( m: Option<&FieldMetadata>, n: Option<&FieldMetadata>, ) -> Option<FieldMetadata>
Merges two optional FieldMetadata
instances, overwriting any existing
keys in m
with keys from n
if present
Sourcepub fn new_from_field(field: &Field) -> Self
pub fn new_from_field(field: &Field) -> Self
Create a new metadata instance from a Field
’s metadata.
Sourcepub fn new(inner: BTreeMap<String, String>) -> Self
pub fn new(inner: BTreeMap<String, String>) -> Self
Create a new metadata instance from a map of string keys to string values.
Sourcepub fn inner(&self) -> &BTreeMap<String, String>
pub fn inner(&self) -> &BTreeMap<String, String>
Get the inner metadata as a reference to a BTreeMap
.
Sourcepub fn extend(&mut self, other: Self)
pub fn extend(&mut self, other: Self)
Adds metadata from other
into self
, overwriting any existing keys.
Sourcepub fn to_hashmap(&self) -> HashMap<String, String>
pub fn to_hashmap(&self) -> HashMap<String, String>
Convert this FieldMetadata
into a HashMap<String, String>
Sourcepub fn add_to_field(&self, field: Field) -> Field
pub fn add_to_field(&self, field: Field) -> Field
Updates the metadata on the Field with this metadata, if it is not empty.
Trait Implementations§
Source§impl Clone for FieldMetadata
impl Clone for FieldMetadata
Source§fn clone(&self) -> FieldMetadata
fn clone(&self) -> FieldMetadata
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for FieldMetadata
impl Debug for FieldMetadata
Source§impl Default for FieldMetadata
impl Default for FieldMetadata
Source§impl From<&Field> for FieldMetadata
impl From<&Field> for FieldMetadata
Source§impl Hash for FieldMetadata
impl Hash for FieldMetadata
Source§impl PartialEq for FieldMetadata
impl PartialEq for FieldMetadata
Source§impl PartialOrd for FieldMetadata
impl PartialOrd for FieldMetadata
impl Eq for FieldMetadata
impl StructuralPartialEq for FieldMetadata
Auto Trait Implementations§
impl Freeze for FieldMetadata
impl RefUnwindSafe for FieldMetadata
impl Send for FieldMetadata
impl Sync for FieldMetadata
impl Unpin for FieldMetadata
impl UnwindSafe for FieldMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more