1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
use crate::Rule;
use pest::iterators::Pair;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Visibility {
Private,
Public,
}
impl Visibility {
pub fn is_public(&self) -> bool {
matches!(self, &Visibility::Public)
}
pub fn is_private(&self) -> bool {
!self.is_public()
}
pub(crate) fn parse_from_pair(input: Pair<Rule>) -> Self {
match input.as_str().trim() {
"pub" => Visibility::Public,
_ => Visibility::Private,
}
}
}