pub struct Session {
pub version: u32,
pub recent: Vec<PathBuf>,
pub workspace: Option<RestoredWorkspace>,
/* private fields */
}Expand description
What survives a restart.
Fields§
§version: u32The schema version this build writes and fully understands (ADR-0014 §2). No
transitions exist yet — a corrupt or unreadable file already falls back to
Session::default() above the version check, so there is nothing to migrate in
memory until the first breaking change gives this field work to do.
recent: Vec<PathBuf>Most recently opened first.
workspace: Option<RestoredWorkspace>The one workspace that was open at clean shutdown. recent remains the MRU list;
this is the richer, best-effort state used only when reopening that workspace.
Implementations§
Source§impl Session
impl Session
pub const CURRENT_VERSION: u32 = 1
Sourcepub fn parse(text: &str) -> (Self, Vec<SessionDiagnostic>)
pub fn parse(text: &str) -> (Self, Vec<SessionDiagnostic>)
Parse and migrate in memory without ever rewriting as a side effect of loading.
Unknown fields stay in unknown, so a later real save preserves them verbatim.
Sourcepub fn record(&mut self, root: &Path)
pub fn record(&mut self, root: &Path)
Record a workspace as most-recently-used, de-duplicating and capping the list.
Sourcepub fn prune_missing(&mut self, fs: &dyn FileSystemService)
pub fn prune_missing(&mut self, fs: &dyn FileSystemService)
Drop entries that no longer exist, so a deleted project stops being offered.