Guide API
Skip to main content

InputLine

Struct InputLine 

Source
pub struct InputLine {
Show 13 fields pub state: ViewState, pub data: String, pub max_len: i32, pub max_width: i32, pub max_chars: i32, pub cur_pos: i32, pub first_pos: i32, pub sel_start: i32, pub sel_end: i32, pub validator: Option<Box<dyn Validator>>, pub select_all_on_focus: bool, pub mask: Option<char>, pub reveal: bool, /* private fields */
}
Expand description

A single-line text-entry field with selection, horizontal scrolling, an optional Validator, and the typed value/ set_value data protocol.

§Coordinate model — byte offsets vs. display columns

data is a Rust String. The cursor/selection offsets cur_pos / sel_start / sel_end / anchor are byte offsets into it. Slicing a String at a non-char boundary panics, so every step over data goes through text::next / text::prev (whole grapheme clusters) — never +1/-1. prev_word/next_word scan ASCII spaces, whose byte offsets are always char boundaries.

first_pos, by contrast, is a display column (the horizontal scroll offset). The displayed position of an offset is the display width of data[..pos]. For ASCII, byte == column, but for multi-byte / wide content they diverge, so the two units are kept strictly distinct here.

§Clipboard and command enabling

Cut/copy write to the clipboard via Context; paste is requested through the context and the pump reads the backend clipboard and inserts into the field, clamped to max_len and replacing any selection. The field keeps cmCut/cmCopy enabled while there is a selection and cmPaste enabled while it is active and selected, pushing those enable/disable updates as selection and focus change.

§Validation

A Validator gates the contents. Validators may also carry typed, non-text values: value/set_value consult the validator’s transfer_get / transfer_set hook before falling back to the text itself, so a range validator round-trips an integer rather than a string.

Validation runs on focus loss and returns a plain boolean. Deciding validity is a read-only query (valid(&self)); a field that fails validation is not automatically re-focused, since moving focus would require mutable access to the event loop.

§Turbo Vision heritage

Ports TInputLine (tinputli.cpp/dialogs.h). Inheritance becomes the View trait plus ViewState composition (D2); the byte/width/char limit constants become the LimitMode enum (D1); the get/set/size data hooks become the typed value/set_value protocol over FieldValue (D10); and the explicit byte-offset vs. display-column split is the two-unit coordinate model (D13).

Fields§

§state: ViewState

View state (geometry, flags, cursor) — the composition target.

§data: String

The UTF-8 text currently in the field.

Direct reads are fine; to replace the whole content programmatically, prefer View::set_value so the cursor and scroll position are updated consistently. Slicing this string at a non-char boundary panics, so all internal traversals go through text::next / text::prev rather than raw byte arithmetic.

§max_len: i32

Hard cap on data.len() in bytes.

Set at construction time by the limit argument when LimitMode::MaxBytes is active (max_len = limit - 1); otherwise fixed at 255. Insertions that would push data.len() past this value are silently dropped. See also max_width and max_chars for the display-width and grapheme-count caps that the other two limit modes control.

§max_width: i32

Hard cap on the display width of data (in terminal columns).

Active only when the field is constructed with LimitMode::MaxWidth, in which case max_width = limit and max_len is fixed at 255. Defaults to i32::MAX (effectively unbounded) for the other two modes. Wide characters such as CJK ideographs count as 2 columns each.

§max_chars: i32

Hard cap on the grapheme count of data.

Active only when the field is constructed with LimitMode::MaxChars, in which case max_chars = limit and max_len is fixed at 255. Defaults to i32::MAX (effectively unbounded) for the other two modes. A grapheme cluster (e.g. a base letter plus combining diacritic) counts as one regardless of its byte or column size.

§cur_pos: i32

Cursor position, a byte offset into data.

Direct writes are supported — see cursor_request for how this feeds the screen cursor. Direct writes do not scroll the caret into view, though — use set_cursor_pos for that.

§first_pos: i32

Horizontal scroll offset, a display column (see the InputLine docs: NOT a byte offset).

Direct writes are supported — see cursor_request for how this feeds the screen cursor. Direct writes do not scroll the caret into view, though — use set_cursor_pos for that.

§sel_start: i32

Selection start, a byte offset into data.

Direct writes are supported and take effect immediately — nothing is cached. Note this does not move cur_pos or scroll the field; pair with a cur_pos write if the caret should track the selection.

§sel_end: i32

Selection end, a byte offset into data.

Direct writes are supported and take effect immediately — nothing is cached. Note this does not move cur_pos or scroll the field; pair with a cur_pos write if the caret should track the selection.

§validator: Option<Box<dyn Validator>>

The optional input validator, or None when the field is unconstrained.

A Validator can filter individual keystrokes (is_valid_input), check the whole value on focus loss (validate), and carry typed non-text values via the transfer_get/transfer_set hooks so that View::value/View::set_value round-trip an integer rather than a string.

You can read the validator (e.g. to call is_status_ok), but to swap it out after construction use set_validator rather than assigning to this field directly — that keeps the ownership contract explicit.

§select_all_on_focus: bool

Whether the field selects its whole content when it gains focus.

true (the default) matches Turbo Vision’s TInputLine, where becoming selected selects all so the first keystroke replaces the value. Set it false (via set_select_all_on_focus) to suppress that select-all on focus gain — the caret and any existing selection are left untouched and typing inserts rather than replacing. Focus loss still clears the selection either way. Useful for pre-filled or derived fields where select-all-then-type is surprising.

§mask: Option<char>

Echo character painted in place of the real text when set. None = plain field. data/value() always hold the real text; masking is draw-only. Assumes width-1 graphemes (passwords): one echo char per char.

§reveal: bool

Transient: when true, the real text is painted despite mask (reveal).

Implementations§

Source§

impl InputLine

Source

pub const READ_ONLY_REJECTED: Command

Broadcast when a read-only field refuses a change, carrying the field’s own ViewId as the broadcast source so the owner can tell which field was refused and explain it in its own words.

A broadcast rather than a flag the owner polls: the deferred clipboard paste is applied outside any keystroke the owner could poll around, and the source id spares the owner any bookkeeping to map a refusal back to a field. See set_read_only.

Source

pub fn new( bounds: Rect, limit: i32, validator: Option<Box<dyn Validator>>, limit_mode: LimitMode, ) -> Self

Build a field from bounds, a limit, an optional validator, and a LimitMode that decides what limit counts.

The three internal caps are derived from the mode: max_len (byte cap) is limit - 1 clamped to a non-negative range when the mode is byte-based, else 255; max_width is limit only in width mode, else unbounded; max_chars is limit only in char mode, else unbounded. The field is selectable, takes focus on first click, shows a cursor, and starts empty.

Pass None for validator to create an unconstrained field. To attach or replace the validator after construction, use set_validator. For the common case of a byte-limited field with no validator, prefer with_limit.

§Note: headless / unit-test use outside a Program

When constructing an InputLine outside a Program (e.g. in a unit test with a hand-built crate::view::Context), the field will silently ignore all key events unless state.state.selected is set to true before driving it — the same condition a group sets when it focuses a child. All the fields involved are pub, so the workaround is straightforward:

ⓘ
let mut il = InputLine::with_limit(Rect::new(0, 0, 20, 1), 64);
il.state.state.selected = true; // required to receive key events in tests
il.handle_event(&mut Event::Key(/* … */), &mut ctx);
Source

pub fn with_limit(bounds: Rect, limit: i32) -> Self

Convenience constructor with no validator and the default byte-limit mode.

Source

pub fn set_validator(&mut self, validator: Option<Box<dyn Validator>>)

Replace this field’s validator after construction.

Pass Some(validator) to attach a Validator that filters keystrokes and checks the field on focus-change/close, or None to remove any constraint. The previous validator (if any) is dropped.

Most fields set their validator once via InputLine::new; use this when the constraint is only known later (e.g. it depends on another control’s value gathered at dialog-open time).

§Turbo Vision heritage

Mirrors TInputLine::setValidator, which disposed the old validator and assigned the new one.

Source

pub fn set_select_all_on_focus(&mut self, enable: bool)

Enable or disable select-all on focus gain (default enabled).

With true (the Turbo Vision default) the field selects its whole content when it becomes focused, so the first keystroke replaces it. With false the field keeps its caret and any existing selection on focus gain and typing inserts at the caret — the field still clears its selection on focus loss. See select_all_on_focus.

§Turbo Vision heritage

tvision-rs extension to TInputLine. TInputLine always selects all on focus gain.

Source

pub fn set_read_only(&mut self, read_only: bool)

Make the field refuse every change to its text while leaving it fully navigable — the “look but don’t touch” mode.

This is orthogonal to disabled. A disabled view is skipped by focus entirely, so its value can never be scrolled, selected or copied. A read-only field still takes focus, moves its caret, scrolls horizontally, select-alls, and copies; only the text is untouchable:

disabledread_onlyplain
takes focusnoyesyes
caret / horizontal scroll—yesyes
select + copy—yesyes
type / delete / cut / paste—refusedyes

Every refused change consumes the event and broadcasts READ_ONLY_REJECTED, so the owner can tell the user why the field will not budge. Cut and paste are also grayed in the command set, closing the menu route.

Setting this does not change the text, the caret, or the appearance: a read-only field is drawn exactly like an editable one, because the owner — which knows why the field is read-only — is better placed to signal it.

§Turbo Vision heritage

tvision-rs extension to TInputLine.

Source

pub fn is_read_only(&self) -> bool

Whether the field refuses changes. See set_read_only.

Source

pub fn set_value_position(&mut self, position: ValuePosition)

Choose which end of the text View::set_value leaves on screen.

A value wider than the field shows only one end of itself, and the Turbo Vision default (ValuePosition::End) picks the tail: set_value select-alls, which parks caret and view after the last character, ready for the first keystroke to replace the value.

That is wrong for data whose front identifies it — a path, a URL, a distinguished name — where the operator is left staring at …,dc=example,dc=org. ValuePosition::Start homes the caret and the view instead, leaving nothing selected.

This governs set_value only. Focus is separate: see set_select_all_on_focus.

§Turbo Vision heritage

tvision-rs extension to TInputLine. ValuePosition::End is the TInputLine::setData behaviour.

Source

pub fn value_position(&self) -> ValuePosition

Which end of the text set_value leaves on screen. See set_value_position.

Source

pub fn set_mask(&mut self, mask: Option<char>)

Set (or clear) the echo character. Some(ch) masks the display with ch; None restores the plain field. The stored value is unaffected.

§Turbo Vision heritage

tvision-rs extension to TInputLine.

Source

pub fn set_reveal(&mut self, reveal: bool)

Momentarily show the real text despite mask (password reveal). Ignored when the field is not masked.

§Turbo Vision heritage

tvision-rs extension to TInputLine.

Source

pub fn set_cursor_pos(&mut self, pos: i32)

Move the caret to byte offset pos, collapsing any selection and scrolling the field so the caret is visible.

pos is clamped to [0, data.len()]; if the clamped offset does not land on a char boundary it snaps down to the previous one (the same boundary-snap idiom check_valid and View::set_value already use when clamping to max_len).

§Turbo Vision heritage

C++ code assigns the public TInputLine::curPos field directly; this setter does the same and also collapses the selection and scrolls the caret into view.

Source

pub fn home(&mut self)

Move the caret to the start of the field. Extension — see set_cursor_pos.

Source

pub fn end(&mut self)

Move the caret to the end of the field. Extension — see set_cursor_pos.

Source

pub fn select_all(&mut self, enable: bool, scroll: bool)

Select the whole field (enable = true) or deselect it (enable = false), and optionally scroll the cursor into view (scroll = true).

When enable is true the cursor moves to the end of data and the selection covers [0, data.len()]. When false both the cursor and the selection are collapsed to position 0.

Pass scroll = true when the field is gaining focus (so the end of a long value scrolls into view). Pass scroll = false from set_state where the viewport position should be left as-is.

This method does not trigger a redraw on its own — the event loop redraws the whole tree. The screen cursor needs no separate update: it is derived fresh from cur_pos/first_pos via cursor_request on the next pump. Callers that also need to refresh cut/copy/paste command graying call update_commands separately.

Source

pub fn paste_text(&mut self, text: &str)

Insert text from the clipboard at the current cursor position, replacing any active selection and clamping the result to max_len. Called by the pump’s Deferred::InputLinePaste apply arm once the backend has supplied the clipboard text: insert the pasted bytes at the cursor, replacing the selection, clamped so the total byte length does not exceed the byte cap. Tabs/newlines are replaced with spaces. After insertion the cursor sits at the end of the pasted text and the selection is cleared.

A no-op on a read-only field. Both routes into a deferred paste are already refused before they get here, so this is the belt to their braces — and it is silent, because without a Context it cannot broadcast the refusal.

Trait Implementations§

Source§

impl View for InputLine

Source§

fn as_any_mut(&mut self) -> Option<&mut dyn Any>

Exposes the concrete InputLine so the pump’s InputLinePaste broker can downcast and call paste_text.

Source§

fn cursor_request(&self) -> Option<Point>

The screen-cursor column, derived fresh from cur_pos/first_pos on every call — the port of C++ TInputLine::draw’s tail setCursor(displayedPos(curPos)-firstPos+1, 0), which re-derives the cursor every paint rather than caching it. Because this recomputes from the live fields instead of reading a cache, direct writes to cur_pos/ first_pos are always reflected on the next pump. Mirrors the base View::cursor_request focus/visibility gate.

Source§

fn draw(&mut self, ctx: &mut DrawCtx<'_>)

Render the field: background fill, scrolled text, scroll arrows at the edges when the content overflows, and the selection highlight.

Colors come from the theme roles: Role::InputNormal for the background and unselected text of a focused field (or a never-selectable one) within an active pane, Role::InputSurface for a non-focused selectable field in that same active pane, Role::InputInactive once the owning pane recedes, Role::InputArrow for the ◄/► overflow indicators, and Role::InputSelected for highlighted text. Because tvision-rs has no attribute-only paint, the selected substring is redrawn (not just re-attributed) in the selected style at the correct scroll offset — the visible glyphs of the scrolled window, not the raw head of the selection.

The screen cursor position is not set here; cursor placement lives in cursor_request, called by the event loop before each redraw.

Source§

fn handle_event(&mut self, ev: &mut Event, ctx: &mut Context<'_>)

Process keyboard, mouse, and command events while the field is selected.

Keyboard: printable characters are inserted at the cursor (replacing any active selection, with validator filtering and all three caps checked). Navigation keys (arrows, Home, End, Ctrl-arrows, Ins, Delete, Backspace, Ctrl-Y) are dispatched through the global keymap and applied by apply_input_command. Shift-held movement extends the selection block. Unhandled keys (Tab, Enter, Escape, modified characters outside the repertoire) are left live so the enclosing dialog can route them.

Mouse: a single click positions the cursor; a double-click selects all. Click-and-drag or a click on a scroll-arrow arms a press-and-hold tracking capture that continues updating selection or scroll position on each Event::MouseAuto / Event::MouseMove tick until mouse-up.

Commands: Command::CUT, Command::COPY, and Command::PASTE are consumed here; other commands fall through.

After each handled event, cut/copy/paste command graying is refreshed via update_commands (only while both active and selected).

Source§

fn set_state(&mut self, flag: StateFlag, enable: bool, ctx: &mut Context<'_>)

Apply a state-flag change and react to focus transitions.

Flips the requested flag on ViewState, then:

  • On StateFlag::Selected (or StateFlag::Active while the field is already selected): calls select_all(enable, false) so the field is fully selected when it gains focus and deselected when it loses it.
  • When the active-and-selected condition changes (e.g. the field gains or loses focus): pushes cut/copy/paste command enable/disable updates via update_commands. This is what grays the Edit menu items when focus leaves the field.
Source§

fn valid(&mut self, cmd: Command, ctx: &mut Context<'_>) -> bool

With a validator: the validate command reports the validator’s status; any other non-cancel command runs the validator and fails if invalid. Without a validator: always valid.

Source§

fn value(&self) -> Option<FieldValue>

Return the field’s current value as a FieldValue.

If the attached validator supports typed transfer (transfer_get returns Some), that typed value is returned — for example, a RangeValidator with transfer enabled yields FieldValue::Int(n) rather than FieldValue::Text. Otherwise (no validator, or transfer disabled) the raw field text is returned as FieldValue::Text.

Call this from a dialog’s gather pass (or directly) to read the field’s value in a type-safe way. For a plain text field with no validator the result is always Some(FieldValue::Text(…)).

Source§

fn set_value(&mut self, v: FieldValue)

Load a value into the field, replacing the current contents, and select all.

If the attached validator supports typed transfer (transfer_set returns Some), the validator formats the value into the display text (e.g. FieldValue::Int(42) becomes "42") and select_all(true, true) is called. Otherwise, a FieldValue::Text value is loaded directly, truncated to max_len bytes at the nearest char boundary if it is too long, and the field is selected. A FieldValue::Int into a field with no transfer-enabled validator is silently ignored (type mismatch).

Use this from a dialog’s scatter pass or any time you need to populate the field programmatically and want the cursor/scroll state reset.

Source§

fn state(&self) -> &ViewState

Borrow the embedded ViewState (the view’s data members).
Source§

fn state_mut(&mut self) -> &mut ViewState

Mutably borrow the embedded ViewState.
Source§

fn set_modal_answer(&mut self, _cmd: Command)

Stash the user’s choice from an async modal message box this view requested via Context::request_message_box (the answer_to/RouteModalAnswer round-trip). Default: no-op. Overridden by views that drive a Yes/No/Cancel prompt out of valid (e.g. FileEditor caches it for the re-validate).
Source§

fn set_modal_data(&mut self, _data: FieldValue)

Deliver a finished modal’s typed result record to the view that launched it. Defaulted no-op; a launcher view overrides it to load the record. Two producers call it: Read more
Source§

fn set_value_ctx(&mut self, v: FieldValue, ctx: &mut Context<'_>)

Scatter a typed FieldValue into this control with a Context. Default: calls set_value (the context-free setter). Override when scatter needs deferred publishing (e.g. ListBox republishes its vertical scrollbar via focus_item).
Source§

fn awaken(&mut self)

Post-construction initialization hook. Called once after the view has been inserted into its group and the group’s layout is complete — the earliest point at which a view may safely resolve sibling ids or run initialization that requires a fully-wired tree. Override when a widget needs to do work that cannot happen during construction (e.g. reading a linked control’s current value). Base is a no-op.
Source§

fn size_limits(&self, owner_size: Point) -> (Point, Point)

The (min, max) size this view may take inside an owner of owner_size. Read more
Source§

fn calc_bounds(&mut self, owner_size: Point, delta: Point) -> Rect

The new bounds after the owner resized to owner_size (delta = new - old). Computes the size limits via the overridable size_limits hook — so a widget override (e.g. a window’s minimum) participates — then delegates the grow math to ViewState::calc_bounds (the single source). Returns the bounds; it does not apply them (change_bounds does).
Source§

fn change_bounds(&mut self, bounds: Rect)

Apply bounds to this view and propagate as needed. Read more
Source§

fn on_bounds_changed(&mut self, _ctx: &mut Context<'_>)

Called by the pump after change_bounds is applied via Deferred::ChangeBounds — provides a Context for re-publishing state that depends on the new bounds (e.g. scrollbar params). Default implementation is a no-op. Read more
Source§

fn caret_size(&self) -> u8

The caret size this view wants while its cursor is shown, as a percentage of the character cell (1..=100). Base: CARET_INSERT (a block) when the cursor_ins state is set, else CARET_NORMAL (the normal caret). The event loop reads it along the same focused chain as cursor_request; Group overrides it to descend into its current child. Read more
Source§

fn find_mut(&mut self, id: ViewId) -> Option<&mut dyn View>

Resolve id to a descendant of this view (never self — the parent identifies a view by id). A leaf has no descendants, so the base returns None; a Group overrides to search its children and recurse; a Group-embedding view delegates to its inner group. This is the “tree-walk via Context” — the uniform way the event loop / a capture handler acts on a view it holds only by id (move a window’s bounds, flip the dragging flag, …).
Source§

fn remove_descendant(&mut self, id: ViewId, ctx: &mut Context<'_>) -> bool

Remove the descendant named by id from whichever group owns it. Returns true if it was found+removed. Distinct from find_mut because removal happens in the owner’s child Vec (a view cannot remove itself — it doesn’t know its owner) and must run the owning group’s reset_current. Base: false (a leaf owns nothing).
Source§

fn focus_descendant(&mut self, id: ViewId, ctx: &mut Context<'_>) -> bool

Focus (select) the descendant named by id within whichever group owns it — the tree-op behind a label focusing its linked control. Returns true if id was found in this subtree (selectable or not — finding it stops the walk). Distinct from find_mut because focusing happens in the owning group (a view cannot select itself within itself): the owning Group calls focus_child after applying the selectable gate. Base: false (a leaf owns nothing). Read more
Source§

fn has_focusable_leaf(&self) -> bool

Whether this view’s subtree contains a focusable leaf (visible, enabled, selectable). Base: whether THIS view is itself a focusable leaf; Group overrides to recurse into children; wrapper views delegate. Used by the hierarchical Tab traversal to skip selectable-but-empty subtrees.
Source§

fn focus_to_edge(&mut self, backward: bool, ctx: &mut Context<'_>) -> bool

Focus the first (Tab, backward = false) or last (Shift-Tab, backward = true) focusable leaf in this view’s subtree, establishing the full focus path down to it. Returns true if a focusable leaf was focused. Read more
Source§

fn reset_current(&mut self, _ctx: &mut Context<'_>)

Establish this view’s INTERNAL currency — for a group-bearing view, set its current child to the first visible+selectable child. The insert-time currency cascade cannot run inside the context-less Group::insert, so exec_view calls this on a freshly-inserted modal BEFORE focusing it, so the modal’s first selectable child is current on open (otherwise the modal is keyboard-dead until a nav event — see the seam note in exec_view). Base: no-op (a leaf has no internal currency); Group overrides; Window/Dialog delegate.
Source§

fn settle_currency(&mut self, _ctx: &mut Context<'_>)

Run any pending insert-time reset-current cascades in this subtree. Read more
Source§

fn set_visible_descendant( &mut self, id: ViewId, visible: bool, ctx: &mut Context<'_>, ) -> bool

Tree-op: set the visible flag of the descendant named by id from its OWNING group, running the owning group’s currency tail. Toggling visibility on a selectable view re-picks the owner’s current child, in both directions (show and hide). Returns true if id was found in this subtree. Read more
Source§

fn number(&self) -> Option<i16>

The window number for Alt-N selection. Base views are unnumbered (None); Window overrides to return its number when > 0 (0 means unnumbered → None).
Source§

fn grabs_focus_on_click(&self) -> bool

Whether a mouse-down inside this view should auto-select (focus) it — the per-view opt-out for the group’s mouse-down auto-select (see Group::route_event). Default true (the common case); a Button overrides to return its grab-focus flag. A view returning false is not focused by a click but still receives the click (so it can act, e.g. press, without becoming the current view).
Source§

fn select_window_num(&mut self, num: i16, ctx: &mut Context<'_>) -> bool

Tree-op: ask this subtree to select the window numbered num. Returns whether one matched. Consistent with the find_mut / remove_descendant tree-op family: the live loop holds a subtree only by id (here, the desktop) and asks it to act. Default: no-op (false). Desktop overrides.
Source§

fn tile(&mut self, _r: Rect)

Tree-op: lay this subtree’s tileable windows out in a grid (the tile command). Base: no-op (only Desktop lays out windows). r is the desktop-local layout rect. Mirrors select_window_num: the live loop drives the desktop by id through &mut dyn View.
Source§

fn cascade(&mut self, _r: Rect)

Tree-op: lay this subtree’s tileable windows out cascaded (the cascade command). Base: no-op; Desktop overrides.
Source§

fn apply_scroll_sync( &mut self, _h: Option<i32>, _v: Option<i32>, _ctx: &mut Context<'_>, )

The shared scrollbar read-sync broker hook. Defaulted no-op; scroll-aware widgets override it to apply a freshly-read scrollbar delta to themselves. The pump passes the horizontal/vertical scrollbar values (None if that bar is absent or unresolved), each read via View::value. Overridden by the list viewers (delegate to list_viewer::apply_scroll), Scroller, the outline viewer, and the editor — every sibling-scrollbar read sync routes through this one method instead of a pump downcast. Read more
Source§

fn update_menu_commands(&mut self, _disabled_cmds: &CommandSet)

The menu command-graying broker hook. Defaulted no-op; menu views override to re-gray their menu tree against the program’s live disabled-command set (denylist — the argument is the set of commands currently disabled; an item grays iff its command is in it). The free fn menu::menu_view::update_menu_commands implements the re-gray walk. Read more
Source§

fn set_menu_current(&mut self, _current: Option<usize>)

The menu-highlight write-back hook. Defaulted no-op; menu views (MenuBar / MenuBox) override to set their MenuViewState::current — the write-only display cache their draw reads to pick the selected colour. Read more
Source§

fn get_help_ctx(&self) -> HelpCtx

The effective help context for status-line switching. Returns HelpCtx::DRAGGING while the view is being dragged, otherwise the view’s own ViewState::help_ctx. Read more
Source§

fn descendant_global_bounds(&self, _id: ViewId, _acc: Point) -> Option<Rect>

Resolve descendant id to its absolute bounds, given acc = this view’s own absolute origin. Base returns None (a leaf owns no descendants); a Group overrides to walk its children accumulating origins, and a Group-embedding view delegates to its inner group. The THistory open path needs its linked input line’s bounds in the root/absolute frame, because exec_view root-inserts the modal and the modal frame hit-tests in absolute coords (the documented ROOT-INSERT + (0,0) caveat). Mirrors find_mut’s recursion but returns geometry, not a borrow.
Source§

fn set_indicator_value(&mut self, _location: Point, _modified: bool)

The editor→indicator status-push broker hook. Defaulted no-op; the editor’s status Indicator overrides it to store the new cursor location + modified flag. Driven by Deferred::IndicatorSetValue: the editor (a leaf) cannot reach its indicator sibling inline, so it requests this and the pump calls the method by id — virtual dispatch, not a downcast.
Source§

fn apply_page_sync(&mut self, _idx: usize, _ctx: &mut Context<'_>)

The tab-bar→page-stack switch broker hook. Defaulted no-op; PageStack overrides it to make page idx active. Driven by Deferred::PageStackSync: the pump reads the bound tab bar’s value and calls this method by id — virtual dispatch, not a downcast.

Auto Trait Implementations§

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
§

impl<T> Downcast for T
where T: 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.
§

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.
§

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.
§

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.
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.