pub struct Console { /* private fields */ }Expand description
The console / shell component.
Implementations§
Source§impl Console
impl Console
pub fn new(title: impl Into<String>) -> Self
pub fn with_prompt(self, p: impl Into<String>) -> Self
pub fn with_cursor(self, c: Cursor) -> Self
Sourcepub fn with_max_lines(self, n: usize) -> Self
pub fn with_max_lines(self, n: usize) -> Self
Cap the scrollback ring (oldest lines dropped past this).
Sourcepub fn state(&self) -> &ConsoleModel
pub fn state(&self) -> &ConsoleModel
FC-3 — read the complete observable state at any frame boundary.
Sourcepub fn push_line(&mut self, raw: impl AsRef<str>)
pub fn push_line(&mut self, raw: impl AsRef<str>)
Append a raw line (ANSI-parsed), dropping the oldest past max_lines.
Sourcepub fn select(&mut self, id: Option<LineId>)
pub fn select(&mut self, id: Option<LineId>)
Select a scrollback line by stable id (or clear). A thin wrapper over the FC-2 mutation path.
Sourcepub fn advance(&mut self, dt: f32)
pub fn advance(&mut self, dt: f32)
Advance the scrollback animation (the injected clock; deterministic).
pub fn line_count(&self) -> usize
Sourcepub fn is_idle(&self) -> bool
pub fn is_idle(&self) -> bool
Whether the console is idle (FC-8). The console is host-pushed and
synchronous — lines arrive via push_line and there is no
internal async work — so it is always idle from the component’s own
perspective. (A submitted command’s execution is the host’s RunCommand
effect, not the console’s own work.)
Sourcepub fn plain_text(&self) -> String
pub fn plain_text(&self) -> String
The plain-text scrollback (for copy/search).
Source§impl Console
impl Console
Sourcepub fn view(&self, ui: &mut Ui) -> Vec<Msg>
pub fn view(&self, ui: &mut Ui) -> Vec<Msg>
FC-9 render — a pure function of &self: it paints the scrollback +
the prompt/cursor and returns the Msgs the gestures produced (typing,
backspace, submit, history, scroll, per-line select). It MUST NOT mutate the
ConsoleModel; the impl_facet_via_elm!
bridge applies the returned messages through update.
The only &self-external effects are egui-side, not model writes: it may
request_focus/request_repaint. The layout-derived scroll extent is
returned as a Msg::SetScrollMax (applied next frame) rather than written
here — that is the deliberate one-frame trail noted on the crate.
Trait Implementations§
Source§impl CopySource for Console
impl CopySource for Console
Source§fn copy_kinds(&self) -> &[ClipKind]
fn copy_kinds(&self) -> &[ClipKind]
Source§fn copy_payload(&self) -> Option<ClipPayload>
fn copy_payload(&self) -> Option<ClipPayload>
Source§impl Elm for Console
impl Elm for Console
Source§type Model = ConsoleModel
type Model = ConsoleModel
Source§type Msg = Msg
type Msg = Msg
Model.Source§type Effect = Effect
type Effect = Effect
enum Effect {} when the component does no I/O.Source§fn title(&self) -> &str
fn title(&self) -> &str
Facet::title).Source§fn state(&self) -> &ConsoleModel
fn state(&self) -> &ConsoleModel
Source§impl Facet for Console
impl Facet for Console
Source§fn ui(&mut self, ui: &mut Ui)
fn ui(&mut self, ui: &mut Ui)
FC-9: the view is pure (paints + emits Msgs); FC-2: mutation only
via update. The immediate-mode trait just bridges the two.
fn title(&self) -> &str
fn state_json(&self) -> Value
Source§fn selection_json(&self) -> Value
fn selection_json(&self) -> Value
state_json by
convention). Null when nothing/none selectable.Source§fn set_scale(&mut self, scale: f32)
fn set_scale(&mut self, scale: f32)
Source§fn copy(&mut self) -> Option<String>
fn copy(&mut self) -> Option<String>
Source§fn as_any_mut(&mut self) -> Option<&mut dyn Any>
fn as_any_mut(&mut self) -> Option<&mut dyn Any>
FacetDeck (e.g. a robot-UI driver clicking an
app-level control that must forward to a concrete component’s own API).
Defaulted to None so no existing facet has to change; a component opts in
by returning Some(self).Source§fn cut(&mut self) -> Option<String>
fn cut(&mut self) -> Option<String>
copy, but also removes the selection. Default delegates to copy.Source§fn kind(&self) -> &'static str
fn kind(&self) -> &'static str
"jobview", "graphpan", "table"). Two
instances with the same kind can exchange portable state; the empty
default "" means opted out of cross-instance clone.Source§fn portable_state(&self) -> Option<Value>
fn portable_state(&self) -> Option<Value>
None = not cloneable. Kept SEPARATE from
state_json (the introspection dump, which may carry
derived / render-only data) so this stays round-trippable through
load_state.Source§fn load_state(&mut self, _state: &Value) -> bool
fn load_state(&mut self, _state: &Value) -> bool
portable_state
on a same-kind sibling. Returns true if accepted. Default false
(opt-in per component).