From c63c3e8c8c73ed7c036df7511ca190cdb96d92e2 Mon Sep 17 00:00:00 2001 From: John Turner Date: Wed, 17 Dec 2025 06:45:27 +0000 Subject: debugging --- crates/parseable/Cargo.toml | 7 +++++++ crates/parseable/src/lib.rs | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 crates/parseable/Cargo.toml create mode 100644 crates/parseable/src/lib.rs (limited to 'crates/parseable') 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; + + fn parser() -> Self::Parser; + + fn parse(input: I) -> Result + where + Self: Sized, + { + Self::parser() + .parse_finished(InputIter::new(input)) + .map_err(|e| e.rest()) + } +} -- cgit v1.2.3