diff options
| author | John Turner <jturner.usa@gmail.com> | 2025-12-17 06:45:27 +0000 |
|---|---|---|
| committer | John Turner <jturner.usa@gmail.com> | 2025-12-17 06:45:27 +0000 |
| commit | c63c3e8c8c73ed7c036df7511ca190cdb96d92e2 (patch) | |
| tree | 3262ef318f03388d37ac28493e42c1638c227c27 /crates/parseable | |
| parent | 0ec856797256b5d9807929e1b32c03756eb43124 (diff) | |
| download | gentoo-utils-split-into-workspace.tar.gz | |
debuggingsplit-into-workspace
Diffstat (limited to 'crates/parseable')
| -rw-r--r-- | crates/parseable/Cargo.toml | 7 | ||||
| -rw-r--r-- | crates/parseable/src/lib.rs | 18 |
2 files changed, 25 insertions, 0 deletions
diff --git a/crates/parseable/Cargo.toml b/crates/parseable/Cargo.toml new file mode 100644 index 0000000..25b0c77 --- /dev/null +++ b/crates/parseable/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "parseable" +version = "0.1.0" +edition = "2024" + +[dependencies] +mon = { workspace = true }
\ No newline at end of file diff --git a/crates/parseable/src/lib.rs b/crates/parseable/src/lib.rs new file mode 100644 index 0000000..38ed418 --- /dev/null +++ b/crates/parseable/src/lib.rs @@ -0,0 +1,18 @@ +#![feature(impl_trait_in_assoc_type)] + +use mon::{Parser, input::{Input, InputIter}}; + +pub trait Parseable<'a, I: Input + 'a> { + type Parser: Parser<I, Output = Self>; + + fn parser() -> Self::Parser; + + fn parse(input: I) -> Result<Self, I> + where + Self: Sized, + { + Self::parser() + .parse_finished(InputIter::new(input)) + .map_err(|e| e.rest()) + } +} |
