Skip to main content

SnippetState

Struct SnippetState 

Source
pub struct SnippetState { /* private fields */ }
Expand description

Snippet-owned state grouped off the App god-struct. Holds the on-disk snippet store, the edit form, the pending execution payload, the output screen state, the param form, the terminal-submit flag, the dirty-check baseline and the pending-delete index. Pure state container.

Implementations§

Source§

impl SnippetState

Source

pub fn store(&self) -> &SnippetStore

Source

pub fn store_mut(&mut self) -> &mut SnippetStore

Source

pub fn form(&self) -> &SnippetForm

Source

pub fn form_mut(&mut self) -> &mut SnippetForm

Source

pub fn output(&self) -> Option<&SnippetOutputState>

Source

pub fn output_mut(&mut self) -> Option<&mut SnippetOutputState>

Source

pub fn set_output(&mut self, output: Option<SnippetOutputState>)

Source

pub fn take_output(&mut self) -> Option<SnippetOutputState>

Source

pub fn param_form(&self) -> Option<&SnippetParamFormState>

Source

pub fn param_form_mut(&mut self) -> Option<&mut SnippetParamFormState>

Source

pub fn set_param_form(&mut self, param_form: Option<SnippetParamFormState>)

Source

pub fn pending_delete(&self) -> Option<usize>

Source

pub fn take_pending_delete(&mut self) -> Option<usize>

Source

pub fn pending(&self) -> Option<&(Snippet, Vec<String>)>

Source

pub fn take_pending(&mut self) -> Option<(Snippet, Vec<String>)>

Source

pub fn set_pending(&mut self, value: Option<(Snippet, Vec<String>)>)

Source

pub fn pending_terminal(&self) -> bool

Source

pub fn set_pending_terminal(&mut self, value: bool)

Source

pub fn form_baseline(&self) -> Option<&SnippetFormBaseline>

Source

pub fn set_form_baseline(&mut self, baseline: Option<SnippetFormBaseline>)

Source

pub fn with_store_loaded() -> Self

Construct with snippet store loaded from disk.

Source

pub fn request_delete(&mut self, idx: usize)

Open a delete confirmation for the snippet at idx. The renderer reads pending_delete to draw the confirm overlay.

Source

pub fn cancel_delete(&mut self)

Dismiss a pending delete confirmation. Idempotent.

Source

pub fn close_param_form(&mut self)

Close the parameter substitution form. Clears the form state and the terminal-submit flag that decide whether the next Enter sends the resolved command to the foreground terminal or to background output capture. Idempotent.

Trait Implementations§

Source§

impl Default for SnippetState

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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, 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