Whether the console is enabled. This will be
false in release
mode unless the
force-enabled feature is switched on.
When this is
false, all methods of the
Console struct will
do nothing and return only default values.
Tries to parse the text entered so far as the given type, and clear the entry.
This uses the
FromStr trait to parse the entry. You should implement this
trait on the type you're using for your commands.
Returns a reference to the text entered so far.
Returns an iterator over the previously confirmed entries. This yields items in the order from most recent to least recent.
pub fn history_deduped(&self) -> impl Iterator<Item = &str>[src]
The same as
history, but will not yield the same entry twice in a row.
pub fn history_len(&self) -> usize[src]
Returns the number of items in the history. Note that this includes duplicate entries.
Clears and sets the value of the entire command entry.
pub fn receive_char(&mut self, ch: char)[src]
Receive an individual character and append it to the command entry.
Receive an individual character and append it to the command entry
filter argument returns true for it.
Useful for limiting which characters can be entered.
let mut console = dbgcmd::Console::new(); let ch = '?'; let accepted = console.receive_char_if(ch, char::is_alphanumeric); assert!(!accepted); assert!(console.entry().is_empty());
Removes the last character of the command entry.
Clears the command entry.
pub fn clear_history(&mut self)[src]
Clears the entire command history.
Cycles through the command history towards older entries.
true if there was an older entry, and
false if not. If there
is no older entry, the cursor does not move.
pub fn up_deduped(&mut self) -> bool[src]
Cycles through the command history towards older entries, ignoring duplicates.
true if there was an older entry that differs from the current entry.
Cycles through the command history towards newer entries.
true if there was a newer entry, including the current input.
false if there was no newer entry.
pub fn down_deduped(&mut self) -> bool[src]
Cycles through the command history towards newer entries, ignoring duplicates.
true if there was a newer entry that differs from the current entry.
Whether or not the Console is in a visible state. This does not affect the functionality of any other method, and is intended to be used by you to decide whether or not to render the console.
Sets the Console to be visible.
Sets the Console to be hidden.
pub fn toggle_shown(&mut self)[src]
Toggles the visible state of the Console.
impl StructuralEq for Console[src]
impl StructuralPartialEq for Console[src]
impl RefUnwindSafe for Console
impl UnwindSafe for Console
type Owned = T
The resulting type after obtaining ownership.
fn clone_into(&self, target: &mut T)[src]
type Error = Infallible
The type returned in the event of a conversion error.