pub struct AppState {
pub theme: Option<String>,
pub last_dir: Option<PathBuf>,
pub last_dir_right: Option<PathBuf>,
pub sort_mode: Option<SortMode>,
pub show_hidden: Option<bool>,
pub single_pane: Option<bool>,
pub cd_on_exit: Option<bool>,
pub editor: Option<String>,
}Expand description
All application state that is persisted between sessions.
Every field is an Option so that absent keys are handled gracefully —
the caller provides a sensible default for any field that is None.
§Example
use crate::persistence::{AppState, load_state, save_state};
use tui_file_explorer::SortMode;
let mut state = load_state();
state.theme = Some("nord".into());
state.sort_mode = Some(SortMode::SizeDesc);
state.show_hidden = Some(true);
save_state(&state);Fields§
§theme: Option<String>Colour theme name (e.g. "grape", "nord", "catppuccin-mocha").
last_dir: Option<PathBuf>Directory that was open in the left pane when the app last exited.
Only restored when the path still exists as a directory; stale entries (deleted directories) are silently ignored.
last_dir_right: Option<PathBuf>Directory that was open in the right pane when the app last exited.
Only restored when the path still exists as a directory; stale entries (deleted directories) are silently ignored.
sort_mode: Option<SortMode>Active sort mode: Name, SizeDesc, or Extension.
Whether hidden (dot-prefixed) files were visible.
single_pane: Option<bool>Whether single-pane mode was active.
cd_on_exit: Option<bool>Whether the cd-on-exit feature is enabled.
When true, tfe prints the active pane’s current directory to stdout
on dismiss so the shell wrapper can cd to it. When false (default),
dismissing without a selection prints nothing and exits with code 1.
editor: Option<String>The editor to use when the user presses e on a file.
Serialised as a short key string (e.g. "helix", "nvim",
"custom:code"). None means “use the compiled-in default” (Helix).
Trait Implementations§
impl Eq for AppState
impl StructuralPartialEq for AppState
Auto Trait Implementations§
impl Freeze for AppState
impl RefUnwindSafe for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
impl UnwindSafe for AppState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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