pub struct SessionState {
pub last_root: Option<PathBuf>,
pub left_width: Option<u32>,
pub right_width: Option<u32>,
}Expand description
Small runtime state persisted between launches.
Fields§
§last_root: Option<PathBuf>The most recently opened root directory, if any.
left_width: Option<u32>Left dock width from the last interactive resize, if any. Overrides the
configured [panel] width on the next launch.
right_width: Option<u32>Right dock width from the last interactive resize, if any.
Implementations§
Source§impl SessionState
impl SessionState
Sourcepub fn load() -> Self
pub fn load() -> Self
Load state from the environment’s state file. Missing or broken files yield an empty default.
Sourcepub fn load_from_path(path: &Path) -> Self
pub fn load_from_path(path: &Path) -> Self
Load state from an explicit path.
Sourcepub fn save(&self) -> Result<()>
pub fn save(&self) -> Result<()>
Persist state to the environment’s state file, creating directories.
Sourcepub fn save_to_path(path: &Path, state: &Self) -> Result<()>
pub fn save_to_path(path: &Path, state: &Self) -> Result<()>
Persist state to an explicit path, creating parent directories.
Atomic: the serialized bytes are written to a sibling temp file first and
then renamed over the target, so a crash mid-write can never leave a
truncated state.toml behind (the old file stays intact until the swap).
Trait Implementations§
Source§impl Clone for SessionState
impl Clone for SessionState
Source§impl Debug for SessionState
impl Debug for SessionState
Source§impl Default for SessionState
impl Default for SessionState
Source§impl<'de> Deserialize<'de> for SessionState
impl<'de> Deserialize<'de> for SessionState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SessionState
Source§impl PartialEq for SessionState
impl PartialEq for SessionState
Source§impl Serialize for SessionState
impl Serialize for SessionState
impl StructuralPartialEq for SessionState
Auto Trait Implementations§
impl Freeze for SessionState
impl RefUnwindSafe for SessionState
impl Send for SessionState
impl Sync for SessionState
impl Unpin for SessionState
impl UnsafeUnpin for SessionState
impl UnwindSafe for SessionState
Blanket Implementations§
Source§impl<C> AsyncPosition<()> for C
impl<C> AsyncPosition<()> for C
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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