use std::borrow::Cow;
use crate::forms::text::SyntaxError;
#[derive(Debug)]
pub(super) struct Failure(Box<SyntaxError>);
impl Failure {
pub(super) fn new(error: SyntaxError) -> Self {
Self(Box::new(error))
}
pub(super) fn into_inner(self) -> SyntaxError {
*self.0
}
}
pub(super) trait Build<'t> {
type Value;
fn null(&mut self) -> Self::Value;
fn boolean(&mut self, b: bool) -> Self::Value;
fn int(&mut self, n: i64) -> Self::Value;
fn float(&mut self, f: f64) -> Self::Value;
fn string(&mut self, s: Cow<'t, str>) -> Self::Value;
fn list_mark(&self) -> usize;
fn push_item(&mut self, v: Self::Value);
fn end_list(&mut self, mark: usize) -> Self::Value;
fn map_mark(&self) -> usize;
fn push_entry(&mut self, key: Cow<'t, str>, v: Self::Value);
fn has_key(&self, mark: usize, key: &str) -> bool;
fn each_key(&self, mark: usize, f: &mut dyn FnMut(&str));
fn end_map(&mut self, mark: usize) -> Self::Value;
}