Skip to content

Commit 64fa8ca

Browse files
committed
Closes: #84
1 parent 7777200 commit 64fa8ca

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/expr.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,20 @@ impl PartialEq for Expression {
708708
}
709709
}
710710

711+
impl std::str::FromStr for Expression {
712+
type Err = crate::error::ParseError;
713+
714+
fn from_str(s: &str) -> Result<Self, Self::Err> {
715+
Expression::parse(s)
716+
}
717+
}
718+
719+
impl std::fmt::Display for Expression {
720+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
721+
f.write_str(&self.original)
722+
}
723+
}
724+
711725
/// A propositional logic used to evaluate `Expression` instances.
712726
///
713727
/// An `Expression` consists of some predicates and the `any`, `all` and `not` operators. An

0 commit comments

Comments
 (0)