pub struct LineEditor {
pub buffer: String,
pub cursor_pos: usize,
/* private fields */
}Expand description
A stateful editor for a single line of text.
Fields§
§buffer: String§cursor_pos: usizeImplementations§
Source§impl LineEditor
impl LineEditor
Sourcepub const fn new(history_len: usize) -> Self
pub const fn new(history_len: usize) -> Self
Create a new LineEditor initialized for a new line.
Sourcepub fn input_char(&mut self, code: u32, history: &[String]) -> Option<String>
pub fn input_char(&mut self, code: u32, history: &[String]) -> Option<String>
Process a raw key code, updating the internal state.
The code can be a printable ASCII character or a special value representing
a control key or escape sequence.
Returns Some(buffer) if Enter was pressed, indicating the line is complete.
Auto Trait Implementations§
impl Freeze for LineEditor
impl RefUnwindSafe for LineEditor
impl Send for LineEditor
impl Sync for LineEditor
impl Unpin for LineEditor
impl UnsafeUnpin for LineEditor
impl UnwindSafe for LineEditor
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