Skip to content

Commit

Permalink
docs(stream): Remove Stateful's use of cell
Browse files Browse the repository at this point in the history
This isn't needed with the new `&mut I` API as of 0.5
  • Loading branch information
epage committed Jul 19, 2024
1 parent 3077bb0 commit 57bd582
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,12 @@ impl<I: Stream + crate::lib::std::fmt::Debug, E: crate::lib::std::fmt::Debug>
/// # use winnow::ascii::alpha1;
/// # type Error = ();
///
/// #[derive(Clone, Debug)]
/// struct State<'s>(&'s Cell<u32>);
/// #[derive(Debug)]
/// struct State<'s>(&'s mut u32);
///
/// impl<'s> State<'s> {
/// fn count(&self) {
/// self.0.set(self.0.get() + 1);
/// fn count(&mut self) {
/// *self.0 += 1;
/// }
/// }
///
Expand All @@ -304,10 +304,10 @@ impl<I: Stream + crate::lib::std::fmt::Debug, E: crate::lib::std::fmt::Debug>
/// }
///
/// let data = "Hello";
/// let state = Cell::new(0);
/// let input = Stream { input: data, state: State(&state) };
/// let mut state = 0;
/// let input = Stream { input: data, state: State(&mut state) };
/// let output = word.parse(input).unwrap();
/// assert_eq!(state.get(), 1);
/// assert_eq!(state, 1);
/// ```
#[derive(Clone, Copy, Default, Eq, PartialEq)]
#[doc(alias = "LocatedSpan")]
Expand Down

0 comments on commit 57bd582

Please sign in to comment.