Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Add ParserError, AsChar, ContainsToken, Stream to prelude #658

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion benches/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use criterion::black_box;
use winnow::combinator::opt;
use winnow::prelude::*;
use winnow::stream::AsChar;
use winnow::stream::Stream as _;
use winnow::token::one_of;

fn iter(c: &mut criterion::Criterion) {
Expand Down
1 change: 0 additions & 1 deletion examples/ndjson/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use winnow::error::ErrMode;
use winnow::error::Needed;
use winnow::prelude::*;
use winnow::stream::Offset;
use winnow::stream::Stream as _;

fn main() -> Result<(), lexopt::Error> {
let args = Args::parse()?;
Expand Down
2 changes: 1 addition & 1 deletion src/_topic/nom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
//!
//! To save and restore from intermediate states, [`Stream::checkpoint`] and [`Stream::reset`] can help:
//! ```rust
//! use winnow::stream::Stream as _;
//! use winnow::prelude::*;
//! # let mut i = "";
//! # let i = &mut i;
//!
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ pub mod _tutorial;
/// }
/// ```
pub mod prelude {
pub use crate::error::ParserError as _;
pub use crate::stream::AsChar as _;
pub use crate::stream::ContainsToken as _;
pub use crate::stream::Stream as _;
pub use crate::stream::StreamIsPartial as _;
pub use crate::IResult;
pub use crate::PResult;
Expand Down
2 changes: 1 addition & 1 deletion src/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3265,7 +3265,7 @@ pub trait AsChar {
/// # Example
///
/// ```
/// use winnow::stream::AsChar as _;
/// use winnow::prelude::*;
///
/// assert_eq!('a'.as_char(), 'a');
/// assert_eq!(u8::MAX.as_char(), std::char::from_u32(u8::MAX as u32).unwrap());
Expand Down
Loading