pub enum Step<T> {
Ready(T),
NeedInput,
}Expand description
The answer of a StreamReader call: ready, or waiting for more input.
NeedInput is not an error: the input so far is a valid beginning, and
the call can be made again after feed or
end_input.
§Examples
use jsonx_lib::{Event, Step, StreamReader};
let mut r = StreamReader::new();
assert_eq!(r.next_event()?, Step::NeedInput);
r.feed(b"[tr")?;
assert_eq!(r.next_event()?, Step::Ready(Some(Event::StartArray)));
assert_eq!(r.next_event()?, Step::NeedInput); // `tr` is not a value yet
r.feed(b"ue]")?;
assert_eq!(r.next_event()?.ready(), Some(Some(Event::Bool(true))));Variants§
Ready(T)
The call completed with this result.
NeedInput
The input so far ends inside what the call needs: feed more, or end the input, and call again.
Implementations§
Trait Implementations§
impl<T: Copy> Copy for Step<T>
impl<T: Eq> Eq for Step<T>
impl<T: PartialEq> StructuralPartialEq for Step<T>
Auto Trait Implementations§
impl<T> Forget for Step<T>
impl<T> Freeze for Step<T>where
T: Freeze,
impl<T> Move for Step<T>
impl<T> RefUnwindSafe for Step<T>where
T: RefUnwindSafe,
impl<T> Send for Step<T>where
T: Send,
impl<T> Sync for Step<T>where
T: Sync,
impl<T> Unpin for Step<T>where
T: Unpin,
impl<T> UnsafeUnpin for Step<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Step<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more