Trait derive_attribute_utils::SynVersion
source · pub trait SynVersion: Sized {
type Attribute: GetSpan;
type ArgMeta: GetSpan;
type Error;
// Required methods
fn deserialize_attr_args(
attr: &Self::Attribute
) -> Option<Vec<Self::ArgMeta>>;
fn deserialize_list_args(meta: &Self::ArgMeta) -> Option<Vec<Self::ArgMeta>>;
fn deserialize_key(meta: &Self::ArgMeta) -> Option<String>;
fn deserialize_attr_key(meta: &Self::Attribute) -> Option<String>;
fn deserialize_integer<T>(meta: &Self::ArgMeta) -> Option<T>
where T: FromStr,
T::Err: Display;
fn deserialize_float<T>(meta: &Self::ArgMeta) -> Option<T>
where T: FromStr,
T::Err: Display;
fn deserialize_string(meta: &Self::ArgMeta) -> Option<String>;
fn deserialize_bool(meta: &Self::ArgMeta) -> Option<bool>;
fn deserialize_array(meta: &Self::ArgMeta) -> Option<Vec<Self::ArgMeta>>;
fn convert_error(error: Error) -> Self::Error;
}
Expand description
Represents a Syn version and how it can parse attribute data into values
Required Associated Types§
Required Methods§
sourcefn deserialize_attr_args(attr: &Self::Attribute) -> Option<Vec<Self::ArgMeta>>
fn deserialize_attr_args(attr: &Self::Attribute) -> Option<Vec<Self::ArgMeta>>
Parses an attribute list into a vector of its elements as metadata.
sourcefn deserialize_list_args(meta: &Self::ArgMeta) -> Option<Vec<Self::ArgMeta>>
fn deserialize_list_args(meta: &Self::ArgMeta) -> Option<Vec<Self::ArgMeta>>
Parses a nested list into a vector of its elements as metadata.
sourcefn deserialize_key(meta: &Self::ArgMeta) -> Option<String>
fn deserialize_key(meta: &Self::ArgMeta) -> Option<String>
Gets the key from a key value pair as a string.
sourcefn deserialize_attr_key(meta: &Self::Attribute) -> Option<String>
fn deserialize_attr_key(meta: &Self::Attribute) -> Option<String>
Gets the name of an attribute list.
sourcefn deserialize_integer<T>(meta: &Self::ArgMeta) -> Option<T>where
T: FromStr,
T::Err: Display,
fn deserialize_integer<T>(meta: &Self::ArgMeta) -> Option<T>where T: FromStr, T::Err: Display,
Attempts to get an integer from an argument. Returns None if the argument is a different type.
sourcefn deserialize_float<T>(meta: &Self::ArgMeta) -> Option<T>where
T: FromStr,
T::Err: Display,
fn deserialize_float<T>(meta: &Self::ArgMeta) -> Option<T>where T: FromStr, T::Err: Display,
Attempts to get a float from an argument. Returns None if the argument is a different type.
sourcefn deserialize_string(meta: &Self::ArgMeta) -> Option<String>
fn deserialize_string(meta: &Self::ArgMeta) -> Option<String>
Attempts to get a string from an argument. Returns None if the argument is a different type.
sourcefn deserialize_bool(meta: &Self::ArgMeta) -> Option<bool>
fn deserialize_bool(meta: &Self::ArgMeta) -> Option<bool>
Attempts to get a boolean from an argument. Returns None if the argument is a different type.
sourcefn deserialize_array(meta: &Self::ArgMeta) -> Option<Vec<Self::ArgMeta>>
fn deserialize_array(meta: &Self::ArgMeta) -> Option<Vec<Self::ArgMeta>>
Attempts to get an array from an argument and returns a vector of its elements as metadata.
sourcefn convert_error(error: Error) -> Self::Error
fn convert_error(error: Error) -> Self::Error
Converts this crates error into a Syn error.