pub struct TunnelForm {
pub tunnel_type: TunnelType,
pub bind_port: String,
pub remote_host: String,
pub remote_port: String,
pub bind_address: String,
pub focused_field: TunnelFormField,
pub cursor_pos: usize,
}Expand description
Form state for adding/editing a tunnel.
Fields§
§tunnel_type: TunnelType§bind_port: String§remote_host: String§remote_port: String§bind_address: StringHidden field: preserved during edit, not exposed in the form UI.
focused_field: TunnelFormField§cursor_pos: usizeImplementations§
Source§impl TunnelForm
impl TunnelForm
pub fn from_rule(rule: &TunnelRule) -> Self
Sourcepub fn focus_next(&mut self)
pub fn focus_next(&mut self)
Advance the focused field to the next one (skipping remote fields when tunnel_type is Dynamic) and sync the cursor to the end of the new focused value.
Sourcepub fn focus_prev(&mut self)
pub fn focus_prev(&mut self)
Retreat the focused field to the previous one (skipping remote fields when tunnel_type is Dynamic) and sync the cursor to the end of the new focused value.
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validate the form. Returns error message if invalid.
Sourcepub fn to_directive(&self) -> (&'static str, String)
pub fn to_directive(&self) -> (&'static str, String)
Convert to directive key and value for writing to SSH config. Uses TunnelRule for correct IPv6 bracketing and bind_address preservation.
pub fn focused_value(&self) -> Option<&str>
Sourcepub fn focused_value_mut(&mut self) -> Option<&mut String>
pub fn focused_value_mut(&mut self) -> Option<&mut String>
Get mutable reference to the focused text field’s value. Returns None for Type field (uses Left/Right, not text input).
pub fn insert_char(&mut self, c: char)
pub fn delete_char_before_cursor(&mut self)
pub fn sync_cursor_to_end(&mut self)
Trait Implementations§
Source§impl Clone for TunnelForm
impl Clone for TunnelForm
Source§fn clone(&self) -> TunnelForm
fn clone(&self) -> TunnelForm
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TunnelForm
impl RefUnwindSafe for TunnelForm
impl Send for TunnelForm
impl Sync for TunnelForm
impl Unpin for TunnelForm
impl UnsafeUnpin for TunnelForm
impl UnwindSafe for TunnelForm
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
Mutably borrows from an owned value. Read more
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>
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 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>
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