Skip to main content

ConfigEditorState

Struct ConfigEditorState 

Source
pub struct ConfigEditorState {
Show 20 fields pub selected_file: ConfigFile, pub view: ConfigEditorView, pub focus: ConfigEditorFocus, pub file_cursor: usize, pub key_cursor: usize, pub query: String, pub query_caret: usize, pub search_focus: ConfigEditorSearchFocus, pub recent_queries: Vec<String>, pub recent_queries_path: PathBuf, pub recent_queries_dirty: bool, pub query_last_input_change: Instant, pub last_saved_query_value: Option<String>, pub recent_cursor: usize, pub bookmarked_keys: Vec<String>, pub bookmarked_keys_path: PathBuf, pub bookmarked_keys_dirty: bool, pub bookmark_cursor: usize, pub popup: Option<EditPopupState>, pub status: Option<String>,
}
Expand description

Top-level editor state held by crate::state::AppState::config_editor_state.

Fields§

§selected_file: ConfigFile

Currently selected config file (Phase 1: only Settings is functional).

§view: ConfigEditorView

Active top-pane view.

§focus: ConfigEditorFocus

Where typed characters land.

§file_cursor: usize

Cursor in the file-list view (0..=3).

§key_cursor: usize

Cursor in the key-list view, indexing into the filtered list.

§query: String

Search query text (substring/fuzzy filter applied to keys).

§query_caret: usize

Caret position inside query.

§search_focus: ConfigEditorSearchFocus

Which sub-panel in the search pane currently has focus.

§recent_queries: Vec<String>

Most-recent-first search history for the config editor.

§recent_queries_path: PathBuf

Path where config-editor recent searches are persisted.

§recent_queries_dirty: bool

Dirty flag indicating recent queries should be flushed to disk.

§query_last_input_change: Instant

Last time the query text changed from user input.

§last_saved_query_value: Option<String>

Last query value saved by debounce logic to avoid duplicate writes.

§recent_cursor: usize

Cursor in recent_queries.

§bookmarked_keys: Vec<String>

Bookmarked setting keys (canonical EditableSetting::key).

§bookmarked_keys_path: PathBuf

Path where config-editor bookmarks are persisted.

§bookmarked_keys_dirty: bool

Dirty flag indicating bookmarks should be flushed to disk.

§bookmark_cursor: usize

Cursor in bookmarked_keys.

§popup: Option<EditPopupState>

Active edit popup, if any.

§status: Option<String>

Last save outcome / hint, shown in the footer.

Implementations§

Source§

impl ConfigEditorState

Source

pub fn filtered_keys(&self) -> Vec<&'static EditableSetting>

What: Build the filtered key list for the currently selected file and active query.

Inputs: None (uses self.selected_file and self.query).

Output:

  • Vector of schema entries that match the query (or all entries if query is empty), in declaration order.

Details:

  • Phase 1 uses a case-insensitive substring match against the canonical key and aliases via EditableSetting::matches.
Source

pub fn selected_key(&self) -> Option<&'static EditableSetting>

What: Look up the schema entry currently highlighted in the key list.

Inputs: None.

Output:

  • Some(&EditableSetting) when the cursor lands on a row, None when the filter is empty (no matches).
Source

pub fn clamp_key_cursor(&mut self)

What: Clamp key_cursor to the current filtered list length.

Inputs: None. Output: Mutates self.key_cursor. Details: Called after query edits or after rebuilding the key list.

Source

pub fn push_recent_query(&mut self, query: &str)

What: Push a query into most-recent-first history with de-duplication.

Inputs:

  • query: Raw search query.

Output:

  • Mutates recent_queries and recent_cursor.
Source

pub fn toggle_bookmark_key(&mut self, key: &str) -> bool

Toggle bookmark for a setting key.

Source

pub fn clamp_recent_cursor(&mut self)

Clamp recent cursor to bounds.

Source

pub fn clamp_bookmark_cursor(&mut self)

Clamp bookmark cursor to bounds.

Source

pub fn selected_recent_query(&self) -> Option<&str>

Resolve the currently selected recent query.

Source

pub fn selected_bookmarked_key(&self) -> Option<&str>

Resolve the currently selected bookmarked setting key.

Trait Implementations§

Source§

impl Clone for ConfigEditorState

Source§

fn clone(&self) -> ConfigEditorState

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ConfigEditorState

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ConfigEditorState

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

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more