aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index fca5dd5..39f4605 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,6 +1,29 @@
1mod ast; 1mod ast;
2mod eval; 2mod eval;
3mod parser; 3pub mod parser;
4mod string; 4mod string;
5 5
6pub use eval::evaluate; 6pub use eval::evaluate;
7
8trait Wrap<T> {
9 fn wrap<F, U>(self, f: F) -> U
10 where
11 F: Fn(T) -> U,
12 Self: Sized;
13
14 fn wrap_ok<E>(self) -> Result<Self, E>
15 where
16 Self: Sized,
17 {
18 Ok(self)
19 }
20}
21
22impl<T> Wrap<T> for T {
23 fn wrap<F, U>(self, f: F) -> U
24 where
25 F: Fn(T) -> U,
26 {
27 f(self)
28 }
29}