use strum::Display;
use mago_span::HasSpan;
use mago_span::Span;
use crate::cst::generics::SingleGenericParameter;
use crate::cst::keyword::Keyword;
#[derive(Debug, Clone, Eq, PartialEq, Hash, PartialOrd, Ord, Display)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "serde", serde(tag = "type", content = "value"))]
pub enum PropertiesOfFilter {
All,
Public,
Protected,
Private,
}
#[derive(Debug, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
pub struct PropertiesOfType<'arena> {
pub filter: PropertiesOfFilter,
pub keyword: Keyword<'arena>,
pub parameter: SingleGenericParameter<'arena>,
}
impl HasSpan for PropertiesOfType<'_> {
fn span(&self) -> Span {
self.keyword.span().join(self.parameter.span())
}
}
impl std::fmt::Display for PropertiesOfType<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}{}", self.keyword, self.parameter)
}
}