#[allow(clippy::module_name_repetitions)]
pub enum TokenComplexity {
None,
Simple,
Complex,
}
#[allow(clippy::module_name_repetitions)]
#[typetag::serde(tag = "type")]
pub trait RawObjectToken: RawObjectTokenToAny + std::fmt::Debug + Send + Sync {
fn get_complexity(&self) -> TokenComplexity;
fn parse_token(key: &str, value: &str) -> Option<Self>
where
Self: Sized;
}
impl std::fmt::Display for dyn RawObjectToken {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{self:?}")
}
}
pub trait RawObjectTokenToAny: 'static {
fn as_any(&self) -> &dyn std::any::Any;
}
impl<T: 'static> RawObjectTokenToAny for T {
fn as_any(&self) -> &dyn std::any::Any {
self
}
}