pub enum Event<'a> {
Text(&'a [u8]),
Control(u8),
Csi {
private: Option<u8>,
params: &'a [u16],
intermediates: &'a [u8],
final_byte: u8,
},
Esc {
intermediates: &'a [u8],
final_byte: u8,
},
Osc(&'a [u8]),
Other {
intro: u8,
data: &'a [u8],
},
}Expand description
One parsed unit, borrowed: nothing here is owned or copied.
The lifetime is per call, not per feed_with: Event::Text borrows the
bytes passed in, while sequence payloads borrow the parser’s scratch
buffers, which the next sequence reuses. Keep what you need before
returning.
Variants§
Text(&'a [u8])
A run of printable bytes, exactly as they arrived: not validated as
UTF-8, and a multi-byte character split across two feed_with calls
arrives as the tail of one run and the head of the next. Callers that
need str decode it themselves; Parser::feed does that and
replaces invalid bytes with U+FFFD.
Control(u8)
A C0 control byte executed on its own, or DEL.
Csi
A CSI sequence. params and intermediates borrow parser scratch.
Esc
A non-CSI escape sequence.
Osc(&'a [u8])
An OSC string’s payload, without the introducer or terminator.
Other
A DCS/SOS/PM/APC string’s payload.