duesee / duesee/abnf-core

strongly typed ?

Open
#16 1 comment 0 reactions 0 assignees View on GitHub
enhancement help wanted question
Dominant language
Rust
Stars
0
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Should we consider make the parser strongly typed:

```
#[repr(transparent)]
struct Alpha {
c: char,
}

pub fn alpha(input: I) -> IResult
where
I: InputIter + Slice>,
::Item: AsChar,
E: ParseError,
{
let (input, c) = satisfy(is_alpha)(input)?;

Ok((input, Alpha { c }))
}
```

Pro:
- Allow compile time check
- If the user want this, this will reduce the code of user side
- most user will discard this anyway so no call to `into_inner()`
- Increase debug info.

Con:
- User side that don't want it could require call like `into_inner()` to get rid of the wrapper.
- make lib more heavy

Maybe as a feature ?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.