use crate::follows::Segment;
#[derive(Debug, Clone)]
pub struct Context {
level: Vec<Segment>,
}
impl Context {
pub fn first(&self) -> Option<&Segment> {
self.level.first()
}
pub fn first_matches(&self, s: &Segment) -> bool {
self.first() == Some(s)
}
}
impl From<Segment> for Context {
fn from(s: Segment) -> Self {
Self { level: vec![s] }
}
}