use super::Context;
pub(super) trait ContextStackOps {
fn push(&mut self, ctx: Context);
fn pop(&mut self) -> Option<Context>;
fn last(&self) -> Option<&Context>;
fn last_mut(&mut self) -> Option<&mut Context>;
fn len(&self) -> usize;
#[inline]
#[allow(dead_code)] fn is_empty(&self) -> bool {
self.len() == 0
}
}
pub(super) trait AnchorStoreOps {
fn ensure_capacity(&mut self, anchor_id: usize);
fn get(&self, anchor_id: usize) -> Option<&str>;
fn set_if_empty(&mut self, anchor_id: usize) -> &str;
#[allow(dead_code)] fn is_empty(&self, anchor_id: usize) -> bool {
self.get(anchor_id).is_none_or(str::is_empty)
}
}
pub(super) trait FormatterBackend {
type ContextStack: ContextStackOps;
type AnchorStore: AnchorStoreOps;
fn context_stack(&self) -> &Self::ContextStack;
fn context_stack_mut(&mut self) -> &mut Self::ContextStack;
fn anchor_store(&self) -> &Self::AnchorStore;
fn anchor_store_mut(&mut self) -> &mut Self::AnchorStore;
}