pub struct HostForm {Show 16 fields
pub alias: String,
pub hostname: String,
pub user: String,
pub port: String,
pub identity_file: String,
pub proxy_jump: String,
pub askpass: String,
pub vault_ssh: String,
pub vault_addr: String,
pub tags: String,
pub focused_field: FormField,
pub cursor_pos: usize,
pub form_hint: Option<String>,
pub is_pattern: bool,
pub expanded: bool,
pub inherited: InheritedHints,
}Expand description
Form state for adding/editing a host.
Fields§
§alias: String§hostname: String§user: String§port: String§identity_file: String§proxy_jump: String§askpass: String§vault_ssh: String§vault_addr: StringOptional VAULT_ADDR override. Progressive disclosure: the form field
only renders and is only navigable when vault_ssh is non-empty. The
stored value is preserved while hidden so re-enabling the role shows
the previous address again.
focused_field: FormField§cursor_pos: usize§form_hint: Option<String>Real-time validation hint shown in footer.
is_pattern: boolWhen true, alias is a Host pattern (wildcards allowed, hostname optional).
expanded: boolProgressive disclosure: false = only required fields visible, true = all. Excluded from dirty detection (UI-only state).
inherited: InheritedHintsInherited values from matching patterns (value, source pattern). Shown as dimmed placeholders when the field is empty.
Implementations§
Source§impl HostForm
impl HostForm
pub fn new_pattern() -> Self
Sourcepub fn from_entry(entry: &HostEntry, inherited: InheritedHints) -> Self
pub fn from_entry(entry: &HostEntry, inherited: InheritedHints) -> Self
Create form from a raw HostEntry (without pattern inheritance applied).
The inherited hints are computed separately and passed in.
Sourcepub fn from_entry_duplicate(
entry: &HostEntry,
inherited: InheritedHints,
) -> (Self, bool)
pub fn from_entry_duplicate( entry: &HostEntry, inherited: InheritedHints, ) -> (Self, bool)
Create a HostForm from an existing host for the clone/duplicate flow.
Clears fields that must not carry over to the copy: vault_ssh (the
per-host Vault SSH override, which belongs to the original alias’s
certificate) and implicitly certificate_file (not stored on the form
since it is derived from the alias). The caller is still responsible
for setting a unique alias on the returned form.
Returns the cloned form and a flag indicating whether a per-host
Vault SSH override was cleared. Callers display a status when the
flag is true so the user understands why the clone does not inherit
the source host’s Vault SSH role.
pub fn from_pattern_entry(entry: &PatternEntry) -> Self
pub fn focused_value(&self) -> &str
Sourcepub fn focused_value_mut(&mut self) -> &mut String
pub fn focused_value_mut(&mut self) -> &mut String
Get a mutable reference to the currently focused field’s value.
Sourcepub fn visible_fields(&self) -> Vec<FormField>
pub fn visible_fields(&self) -> Vec<FormField>
Returns the fields that are currently visible in the rendered form.
FormField::VaultAddr is hidden (absent) unless the Vault SSH role
field has a non-empty value on the same form. Navigation helpers must
consult this list so Tab/Shift-Tab skip over hidden fields. The stored
vault_addr value survives hiding, so toggling the role back on
restores the previous input.
Sourcepub fn focus_next_visible(&mut self)
pub fn focus_next_visible(&mut self)
Advance focused_field to the next visible field (wrapping).
When the currently focused field is NOT in the visible set (e.g. the user toggled the role off while focused on VaultAddr, which the UI does not currently allow but defensive code must handle), fall back to the first visible field instead of silently skipping to index 1.
Sourcepub fn focus_prev_visible(&mut self)
pub fn focus_prev_visible(&mut self)
Advance focused_field to the previous visible field (wrapping).
Same fallback policy as focus_next_visible: an out-of-set focus
state snaps to the last visible field, not the second-to-last.
pub fn insert_char(&mut self, c: char)
pub fn delete_char_before_cursor(&mut self)
pub fn sync_cursor_to_end(&mut self)
Sourcepub fn apply_password_source(&mut self, value: String, refocus_askpass: bool)
pub fn apply_password_source(&mut self, value: String, refocus_askpass: bool)
Absorb a password-source selection from the password picker. Sets
askpass to value, optionally moves focus to the AskPass field
when the user must type extra characters (custom command or prefix
completion), and parks the cursor at the end of the askpass value
regardless of which field currently has focus.
Sourcepub fn apply_smart_paste(&mut self, parsed: ParsedTarget, clean_alias: String)
pub fn apply_smart_paste(&mut self, parsed: ParsedTarget, clean_alias: String)
Fill parsed user@host:port fields into the form, skipping any
field already at non-default state. Alias is always overwritten
with the caller-supplied short form.
Sourcepub fn update_hint(&mut self)
pub fn update_hint(&mut self)
Run lightweight validation on the focused field and update form_hint.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HostForm
impl RefUnwindSafe for HostForm
impl Send for HostForm
impl Sync for HostForm
impl Unpin for HostForm
impl UnsafeUnpin for HostForm
impl UnwindSafe for HostForm
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more