Got rid of most of the Clone traits on the parser types since some of the parser results now contain owned values rather than just references.
This commit is contained in:
@@ -23,7 +23,7 @@ use nom::sequence::terminated;
|
||||
use nom::sequence::tuple;
|
||||
use nom::IResult;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum DustTag<'a> {
|
||||
DTSpecial(Special),
|
||||
DTComment(Comment<'a>),
|
||||
@@ -52,12 +52,12 @@ pub enum Special {
|
||||
RightCurlyBrace,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum IgnoredWhitespace<'a> {
|
||||
StartOfLine(&'a str),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Comment<'a> {
|
||||
value: &'a str,
|
||||
}
|
||||
@@ -65,12 +65,12 @@ pub struct Comment<'a> {
|
||||
/// A series of keys separated by '.' to reference a variable in the context
|
||||
///
|
||||
/// Special case: If the path is just "." then keys will be an empty vec
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Path<'a> {
|
||||
pub keys: Vec<&'a str>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Reference<'a> {
|
||||
pub path: Path<'a>,
|
||||
pub filters: Vec<Filter>,
|
||||
@@ -87,12 +87,12 @@ pub enum Filter {
|
||||
JsonParse,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Span<'a> {
|
||||
pub contents: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct ParameterizedBlock<'a> {
|
||||
pub path: Path<'a>,
|
||||
pub explicit_context: Option<Path<'a>>,
|
||||
@@ -101,33 +101,33 @@ pub struct ParameterizedBlock<'a> {
|
||||
pub else_contents: Option<Body<'a>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Partial<'a> {
|
||||
pub name: Vec<PartialNameElement>,
|
||||
pub explicit_context: Option<Path<'a>>,
|
||||
pub params: Vec<KVPair<'a>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum OwnedLiteral {
|
||||
LString(String),
|
||||
LPositiveInteger(u64),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum RValue<'a> {
|
||||
RVPath(Path<'a>),
|
||||
RVTemplate(Vec<PartialNameElement>),
|
||||
RVLiteral(OwnedLiteral),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct KVPair<'a> {
|
||||
pub key: &'a str,
|
||||
pub value: RValue<'a>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum PartialNameElement {
|
||||
PNSpan {
|
||||
contents: String,
|
||||
@@ -138,17 +138,17 @@ pub enum PartialNameElement {
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Body<'a> {
|
||||
pub elements: Vec<TemplateElement<'a>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Template<'a> {
|
||||
pub contents: Body<'a>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum TemplateElement<'a> {
|
||||
TESpan(Span<'a>),
|
||||
TETag(DustTag<'a>),
|
||||
|
||||
Reference in New Issue
Block a user