pub trait MetaExt {
// Required methods
fn is_path(&self) -> bool;
fn is_list(&self) -> bool;
fn is_name_value(&self) -> bool;
fn as_path(&self) -> Option<&Path>;
fn as_list(&self) -> Option<&MetaList>;
fn as_name_value(&self) -> Option<&MetaNameValue>;
fn is(&self, name: &str) -> bool;
fn get(&self, path: &str) -> Option<Meta>;
fn nested(&self) -> Option<Vec<Meta>>;
fn span(&self) -> Span;
}Expand description
Extension methods for a single syn::Meta.
Provides variant predicates (is_path, is_list, is_name_value),
conversions (as_path, as_list, as_name_value), name checking,
and dot-path querying into nested meta lists.
§Examples
ⓘ
use zyn::ext::MetaExt;
// Given #[serde(rename = "id", skip)]
assert!(meta.is("serde"));
assert!(meta.is_list());
let rename = meta.get("rename"); // → Some(NameValue meta)
let skip = meta.get("skip"); // → Some(Path meta)Required Methods§
Sourcefn is_name_value(&self) -> bool
fn is_name_value(&self) -> bool
Returns true if this is a Meta::NameValue (e.g., #[foo = expr]).
Sourcefn as_list(&self) -> Option<&MetaList>
fn as_list(&self) -> Option<&MetaList>
Returns the inner syn::MetaList if this is a Meta::List.
Sourcefn as_name_value(&self) -> Option<&MetaNameValue>
fn as_name_value(&self) -> Option<&MetaNameValue>
Returns the inner syn::MetaNameValue if this is a Meta::NameValue.
Sourcefn get(&self, path: &str) -> Option<Meta>
fn get(&self, path: &str) -> Option<Meta>
Navigates nested meta using a dot-separated path with optional index access.
§Examples
ⓘ
use zyn::ext::MetaExt;
// Given meta for #[serde(rename = "id", skip)]
let rename = meta.get("rename"); // → Some(NameValue)
// Given meta for #[derive(Clone, Debug)]
let first = meta.get("[0]"); // → Some(Path for Clone)