pub struct SnippetForm {
pub name: String,
pub command: String,
pub description: String,
pub focused_field: SnippetFormField,
pub cursor_pos: usize,
}Expand description
Form state for adding/editing a snippet.
Fields§
§name: String§command: String§description: String§focused_field: SnippetFormField§cursor_pos: usizeImplementations§
Source§impl SnippetForm
impl SnippetForm
pub fn from_snippet(snippet: &Snippet) -> Self
Sourcepub fn focus_next(&mut self)
pub fn focus_next(&mut self)
Advance the focused field to the next one 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 and sync the cursor to the end of the new focused value.
pub fn focused_value(&self) -> &str
pub fn focused_value_mut(&mut self) -> &mut String
pub fn insert_char(&mut self, c: char)
pub fn delete_char_before_cursor(&mut self)
pub fn sync_cursor_to_end(&mut self)
pub fn validate(&self) -> Result<(), String>
Trait Implementations§
Source§impl Clone for SnippetForm
impl Clone for SnippetForm
Source§fn clone(&self) -> SnippetForm
fn clone(&self) -> SnippetForm
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 SnippetForm
impl RefUnwindSafe for SnippetForm
impl Send for SnippetForm
impl Sync for SnippetForm
impl Unpin for SnippetForm
impl UnsafeUnpin for SnippetForm
impl UnwindSafe for SnippetForm
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