pub struct Console {
pub visible: bool,
pub input: String,
pub cursor: usize,
pub log: VecDeque<LogLine>,
pub scroll_offset: usize,
/* private fields */
}Fields§
§visible: boolWhether the console window is visible.
input: StringCurrent input buffer.
cursor: usizeCursor position in the input buffer (byte offset).
log: VecDeque<LogLine>Output log (newest last).
scroll_offset: usizeScroll offset: 0 = bottom (newest), N = scroll N lines up.
Implementations§
Source§impl Console
impl Console
pub fn new() -> Self
pub fn register_command(&mut self, cmd: Command)
Sourcepub fn delete_forward(&mut self)
pub fn delete_forward(&mut self)
Delete the character at the cursor (Delete key).
Sourcepub fn cursor_left(&mut self)
pub fn cursor_left(&mut self)
Move cursor left by one character.
Sourcepub fn cursor_right(&mut self)
pub fn cursor_right(&mut self)
Move cursor right by one character.
Sourcepub fn cursor_home(&mut self)
pub fn cursor_home(&mut self)
Move cursor to start of input.
Sourcepub fn cursor_end(&mut self)
pub fn cursor_end(&mut self)
Move cursor to end of input.
Sourcepub fn clear_input(&mut self)
pub fn clear_input(&mut self)
Clear the entire input line.
Sourcepub fn history_prev(&mut self)
pub fn history_prev(&mut self)
Navigate to the previous command in history (up arrow).
Sourcepub fn history_next(&mut self)
pub fn history_next(&mut self)
Navigate to the next command in history (down arrow).
Sourcepub fn tab_complete(&mut self)
pub fn tab_complete(&mut self)
Attempt tab completion on the current input.
Sourcepub fn submit(&mut self) -> ConsoleAction
pub fn submit(&mut self) -> ConsoleAction
Submit the current input line. Returns any special engine actions.
pub fn scroll_up(&mut self, lines: usize)
pub fn scroll_down(&mut self, lines: usize)
pub fn scroll_to_bottom(&mut self)
pub fn scroll_to_top(&mut self)
Sourcepub fn visible_lines(&self) -> impl Iterator<Item = &LogLine>
pub fn visible_lines(&self) -> impl Iterator<Item = &LogLine>
Get the slice of log lines currently visible in the console window.
Sourcepub fn input_before_cursor(&self) -> &str
pub fn input_before_cursor(&self) -> &str
The input line split at the cursor for rendering a blinking cursor.
pub fn input_after_cursor(&self) -> &str
pub fn println(&mut self, text: impl Into<String>)
pub fn print_warn(&mut self, text: impl Into<String>)
pub fn print_error(&mut self, text: impl Into<String>)
pub fn print_success(&mut self, text: impl Into<String>)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Console
impl !RefUnwindSafe for Console
impl Send for Console
impl Sync for Console
impl Unpin for Console
impl UnsafeUnpin for Console
impl !UnwindSafe for Console
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.