Minor restructuring
This commit is contained in:
parent
09e16edbe4
commit
1694a2d0f4
@ -1,35 +1,3 @@
|
|||||||
struct TermDisplay<'term>
|
|
||||||
{
|
|
||||||
parent_precedence: Option<i32>,
|
|
||||||
term: &'term crate::Term,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn display_term<'term>(term: &'term crate::Term, parent_precedence: Option<i32>)
|
|
||||||
-> TermDisplay<'term>
|
|
||||||
{
|
|
||||||
TermDisplay
|
|
||||||
{
|
|
||||||
parent_precedence,
|
|
||||||
term,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct FormulaDisplay<'formula>
|
|
||||||
{
|
|
||||||
parent_precedence: Option<i32>,
|
|
||||||
formula: &'formula crate::Formula,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn display_formula<'formula>(formula: &'formula crate::Formula, parent_precedence: Option<i32>)
|
|
||||||
-> FormulaDisplay<'formula>
|
|
||||||
{
|
|
||||||
FormulaDisplay
|
|
||||||
{
|
|
||||||
parent_precedence,
|
|
||||||
formula,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
trait Precedence
|
trait Precedence
|
||||||
{
|
{
|
||||||
fn precedence(&self) -> i32;
|
fn precedence(&self) -> i32;
|
||||||
@ -108,6 +76,22 @@ impl std::fmt::Display for crate::VariableDeclaration
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct TermDisplay<'term>
|
||||||
|
{
|
||||||
|
parent_precedence: Option<i32>,
|
||||||
|
term: &'term crate::Term,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn display_term<'term>(term: &'term crate::Term, parent_precedence: Option<i32>)
|
||||||
|
-> TermDisplay<'term>
|
||||||
|
{
|
||||||
|
TermDisplay
|
||||||
|
{
|
||||||
|
parent_precedence,
|
||||||
|
term,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'term> std::fmt::Debug for TermDisplay<'term>
|
impl<'term> std::fmt::Debug for TermDisplay<'term>
|
||||||
{
|
{
|
||||||
fn fmt(&self, format: &mut std::fmt::Formatter) -> std::fmt::Result
|
fn fmt(&self, format: &mut std::fmt::Formatter) -> std::fmt::Result
|
||||||
@ -195,6 +179,22 @@ impl<'term> std::fmt::Display for TermDisplay<'term>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct FormulaDisplay<'formula>
|
||||||
|
{
|
||||||
|
parent_precedence: Option<i32>,
|
||||||
|
formula: &'formula crate::Formula,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn display_formula<'formula>(formula: &'formula crate::Formula, parent_precedence: Option<i32>)
|
||||||
|
-> FormulaDisplay<'formula>
|
||||||
|
{
|
||||||
|
FormulaDisplay
|
||||||
|
{
|
||||||
|
parent_precedence,
|
||||||
|
formula,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'formula> std::fmt::Debug for FormulaDisplay<'formula>
|
impl<'formula> std::fmt::Debug for FormulaDisplay<'formula>
|
||||||
{
|
{
|
||||||
fn fmt(&self, format: &mut std::fmt::Formatter) -> std::fmt::Result
|
fn fmt(&self, format: &mut std::fmt::Formatter) -> std::fmt::Result
|
||||||
|
Loading…
Reference in New Issue
Block a user