Skip to main content

HostForm

Struct HostForm 

Source
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: String

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

§tags: String§focused_field: FormField§cursor_pos: usize§form_hint: Option<String>

Real-time validation hint shown in footer.

§is_pattern: bool

When true, alias is a Host pattern (wildcards allowed, hostname optional).

§expanded: bool

Progressive disclosure: false = only required fields visible, true = all. Excluded from dirty detection (UI-only state).

§inherited: InheritedHints

Inherited values from matching patterns (value, source pattern). Shown as dimmed placeholders when the field is empty.

Implementations§

Source§

impl HostForm

Source

pub fn new_pattern() -> Self

Source

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.

Source

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.

Source

pub fn from_pattern_entry(entry: &PatternEntry) -> Self

Source

pub fn focused_value(&self) -> &str

Source

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

Get a mutable reference to the currently focused field’s value.

Source

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.

Source

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.

Source

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.

Source

pub fn insert_char(&mut self, c: char)

Source

pub fn delete_char_before_cursor(&mut self)

Source

pub fn sync_cursor_to_end(&mut self)

Source

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.

Source

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.

Source

pub fn update_hint(&mut self)

Run lightweight validation on the focused field and update form_hint.

Source

pub fn validate(&self) -> Result<(), String>

Validate the form. Returns an error message if invalid.

Source

pub fn to_entry(&self) -> HostEntry

Convert to a HostEntry.

Trait Implementations§

Source§

impl Clone for HostForm

Source§

fn clone(&self) -> HostForm

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HostForm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V