use quote::ToTokens;
use crate::path::PathAugment;
pub trait AttributeAugment {
fn extract_val(&self) -> String;
fn str_equals(&self, str: &str) -> bool;
}
impl AttributeAugment for syn::Attribute {
fn extract_val(&self) -> String {
match &self.meta {
syn::Meta::NameValue(name_value) => name_value
.value
.to_token_stream()
.to_string()
.replace([' ', '"'], ""),
_ => panic!("Options must be assigned to an expression"),
}
}
fn str_equals(&self, str: &str) -> bool {
self.path().str_equals(str)
}
}