actson/feeder/mod.rs
1mod bufreader;
2mod push;
3mod slice;
4
5pub use bufreader::BufReaderJsonFeeder;
6pub use push::{PushError, PushJsonFeeder};
7pub use slice::SliceJsonFeeder;
8
9use thiserror::Error;
10
11#[derive(Error, Debug)]
12pub enum FillError {
13 #[error("{0}")]
14 Io(#[from] std::io::Error),
15}
16
17/// A feeder can be used to provide more input data to the
18/// [`JsonParser`](crate::JsonParser).
19pub trait JsonFeeder {
20 /// Determine if the feeder has input data that can be parsed
21 fn has_input(&self) -> bool;
22
23 /// Check if the end of the JSON text has been reached
24 fn is_done(&self) -> bool;
25
26 /// Decode and return the next character to be parsed
27 fn next_input(&mut self) -> Option<u8>;
28}