pub enum WorkerReader<R> {
Yson(JobReader<R>),
Skiff(SkiffJobReader<R>),
}Expand description
A reader selected by the operation’s input DataFormat.
Variants§
Implementations§
Source§impl WorkerReader<BufReader<Stdin>>
impl WorkerReader<BufReader<Stdin>>
Sourcepub fn from_stdin(format: DataFormat) -> Result<Self>
pub fn from_stdin(format: DataFormat) -> Result<Self>
Reads stdin using the operation’s selected input format.
Buffered, because this constructor may end up on the Skiff side, which
reads field by field — see skiff::STDIN_BUFFER_BYTES. The YSON side
asks for a whole buffer at a time and is handed the descriptor’s bytes
without a second copy.
§Errors
Returns an error if the format is unknown to this runtime or a Skiff schema is not suitable for job input.
Source§impl<R: Read> WorkerReader<R>
impl<R: Read> WorkerReader<R>
Sourcepub fn new(input: R, format: DataFormat) -> Result<Self>
pub fn new(input: R, format: DataFormat) -> Result<Self>
Creates a worker input reader selected by format.
§Errors
Returns an error if the format is unknown to this runtime or a Skiff schema is not suitable for job input.
Sourcepub fn next_event(&mut self) -> Result<Option<WorkerEvent<'_>>>
pub fn next_event(&mut self) -> Result<Option<WorkerEvent<'_>>>
Returns the next row or control event, or None at clean end of input.
A returned YSON event borrows the reader’s buffer; process it before calling this method again. Skiff rows are owned.