File tree 4 files changed +12
-21
lines changed 4 files changed +12
-21
lines changed Original file line number Diff line number Diff line change @@ -15,16 +15,7 @@ fn main() {
15
15
16
16
// `from_fn` (available from Rust 1.34) can create an iterator
17
17
// from a closure
18
- let it = std:: iter:: from_fn ( move || {
19
- match parser. parse_next ( & mut data) {
20
- // when successful, a parser returns a tuple of
21
- // the remaining input and the output value.
22
- // So we replace the captured input data with the
23
- // remaining input, to be parsed on the next call
24
- Ok ( o) => Some ( o) ,
25
- _ => None ,
26
- }
27
- } ) ;
18
+ let it = std:: iter:: from_fn ( move || parser. parse_next ( & mut data) . ok ( ) ) ;
28
19
29
20
for value in it {
30
21
println ! ( "parser returned: {value}" ) ;
Original file line number Diff line number Diff line change 32
32
//! 1. Resolve deprecation messages
33
33
//! 1. Commit
34
34
//! 1. Run `cargo add [email protected] `
35
- //! 1. Ensure everything compiles and tests pass, ignoring deprecation messages (see [migration
36
- //! notes](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md#050---2023-07-13))
35
+ //! 1. Ensure everything compiles and tests pass, ignoring deprecation messages
36
+ //! (see [migration notes](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md#050---2023-07-13))
37
37
//! 1. Commit
38
38
//! 1. Resolve deprecation messages
39
39
//! 1. Commit
Original file line number Diff line number Diff line change 16
16
//! ```
17
17
//! 1. We have to decide what to do about the "remainder" of the `input`.
18
18
//! 2. The [`Result`] may not be compatible with the rest of the Rust ecosystem.
19
- //! Normally, Rust applications want errors that are `std::error::Error + Send + Sync + 'static`
20
- //! meaning:
21
- //! - They implement the [`std::error::Error`] trait
22
- //! - They can be sent across threads
23
- //! - They are safe to be referenced across threads
24
- //! - They do not borrow
19
+ //! Normally, Rust applications want errors that are `std::error::Error + Send + Sync + 'static`
20
+ //! meaning:
21
+ //! - They implement the [`std::error::Error`] trait
22
+ //! - They can be sent across threads
23
+ //! - They are safe to be referenced across threads
24
+ //! - They do not borrow
25
25
//!
26
26
//! winnow provides [`Parser::parse`] to help with this:
27
27
//! - Ensures we hit [`eof`]
Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ where
161
161
/// # Arguments
162
162
/// * `init` A function returning the initial value.
163
163
/// * `op` The function that combines a result of `f` with
164
- /// the current accumulator.
164
+ /// the current accumulator.
165
165
///
166
166
/// <div class="warning">
167
167
///
@@ -294,7 +294,7 @@ where
294
294
/// # Arguments
295
295
/// * `init` A function returning the initial value.
296
296
/// * `op` The function that combines a result of `f` with
297
- /// the current accumulator.
297
+ /// the current accumulator.
298
298
///
299
299
/// <div class="warning">
300
300
///
@@ -370,7 +370,7 @@ where
370
370
/// # Arguments
371
371
/// * `init` A function returning the initial value.
372
372
/// * `op` The function that combines a result of `f` with
373
- /// the current accumulator.
373
+ /// the current accumulator.
374
374
///
375
375
/// <div class="warning">
376
376
///
You can’t perform that action at this time.
0 commit comments