pub struct InputParser { /* private fields */ }Expand description
Terminal input parser with DoS protection.
Parse terminal input bytes into events:
ⓘ
let mut parser = InputParser::new();
let events = parser.parse(b"\x1b[A"); // Up arrow
assert_eq!(events.len(), 1);Implementations§
Source§impl InputParser
impl InputParser
Sourcepub fn parse(&mut self, input: &[u8]) -> Vec<Event>
pub fn parse(&mut self, input: &[u8]) -> Vec<Event>
Parse input bytes and return any completed events.
Sourcepub fn parse_with<F>(&mut self, input: &[u8], emit: F)
pub fn parse_with<F>(&mut self, input: &[u8], emit: F)
Parse input bytes and emit each completed event through emit.
Sourcepub fn parse_into(&mut self, input: &[u8], events: &mut Vec<Event>)
pub fn parse_into(&mut self, input: &[u8], events: &mut Vec<Event>)
Parse input bytes and append completed events to events.
This variant lets callers reuse a scratch buffer across parses to avoid repeated allocations on hot input paths.
Trait Implementations§
Source§impl Debug for InputParser
impl Debug for InputParser
Auto Trait Implementations§
impl Freeze for InputParser
impl RefUnwindSafe for InputParser
impl Send for InputParser
impl Sync for InputParser
impl Unpin for InputParser
impl UnwindSafe for InputParser
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