Skip to main content

Console

Struct Console 

Source
pub struct Console<Ctx> { /* private fields */ }

Implementations§

Source§

impl<Ctx: 'static> Console<Ctx>

Source

pub fn new() -> Self

Source

pub fn with_toggle_key(self, key: Key) -> Self

Source

pub fn register<C: Command<Ctx> + 'static>(&mut self, command: C)

Silently replaces any existing command of the same name.

Source

pub fn has_command(&self, name: &str) -> bool

Source

pub fn bind(&mut self, key: Key, command_line: impl Into<String>)

No modifiers; fires only while the console is closed. Re-binding overwrites.

Source

pub fn unbind(&mut self, key: Key)

Source

pub fn open(&mut self)

Source

pub fn close(&mut self)

Source

pub fn toggle(&mut self)

Source

pub fn is_open(&self) -> bool

Source

pub fn detach(&mut self)

Source

pub fn dock(&mut self)

Source

pub fn is_detached(&self) -> bool

Source

pub fn write(&mut self, line: HistoryLine)

Source

pub fn set_status(&mut self, text: impl Into<String>)

Source

pub fn toggle_key(&self) -> Key

Source

pub fn binds(&self) -> impl Iterator<Item = (Key, &str)>

In Key order.

Source

pub fn history(&self) -> &VecDeque<HistoryLine>

Source

pub fn input(&self) -> &str

Source

pub fn input_mut(&mut self) -> &mut String

An edit through this must be followed by Console::cancel_tab_cycle.

Source

pub fn status(&self) -> &str

Source

pub fn submit(&mut self)

Source

pub fn clear_history(&mut self)

Source

pub fn clear_input(&mut self)

Source

pub fn cancel_tab_cycle(&mut self)

Source

pub fn take_pending_focus(&mut self) -> bool

Source

pub fn wants_persistent_focus(&self) -> bool

Source

pub fn set_user_defocused(&mut self, defocused: bool)

Source

pub fn take_pending_cursor_to_end(&mut self) -> bool

Source

pub fn history_prev(&mut self)

Source

pub fn history_next(&mut self)

Source

pub fn tab_complete(&mut self)

Source

pub fn tab_preview(&self) -> Option<String>

Suffix of the first (sort-order) completion; what the next Tab inserts.

Source

pub fn execute(&mut self, line: &str)

Runs a built-in on the spot; parks anything else for Console::drain_pending.

Source

pub fn drain_pending(&mut self) -> Vec<String>

Source

pub fn dispatch(&mut self, name: &str, args: &[&str], ctx: &mut Ctx)

Built-ins resolve here too, so a queued built-in runs like a typed one.

Trait Implementations§

Source§

impl<Ctx: 'static> Default for Console<Ctx>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<Ctx> Freeze for Console<Ctx>

§

impl<Ctx> !RefUnwindSafe for Console<Ctx>

§

impl<Ctx> !Send for Console<Ctx>

§

impl<Ctx> !Sync for Console<Ctx>

§

impl<Ctx> Unpin for Console<Ctx>

§

impl<Ctx> UnsafeUnpin for Console<Ctx>

§

impl<Ctx> !UnwindSafe for Console<Ctx>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.