pub struct Annotations {
pub version: u32,
pub path: String,
pub notes: BTreeMap<String, Note>,
}Fields§
§version: u32§path: StringCanonical absolute path of the session file these annotations
belong to. Recorded for reference / portability — the disk-side
filename is derived via annotations_file_for.
notes: BTreeMap<String, Note>Step index (0-based, as a JSON-string per the format) → note.
BTreeMap keeps iteration order stable for the list overlay
in follow-up work.
Implementations§
Source§impl Annotations
impl Annotations
Sourcepub fn new(session_path: &Path) -> Self
pub fn new(session_path: &Path) -> Self
Fresh, empty annotations bound to the given session path.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
True when no notes are stored. Used by the export integrations to skip emitting a “notes” section and by tests.
Sourcepub fn set(&mut self, step_idx: usize, text: &str) -> bool
pub fn set(&mut self, step_idx: usize, text: &str) -> bool
Upsert a note. Empty / whitespace-only text deletes the entry
(the intuitive “clear the annotation” behavior). Returns true
when the set changed anything.
Sourcepub fn iter(&self) -> impl Iterator<Item = (usize, &Note)>
pub fn iter(&self) -> impl Iterator<Item = (usize, &Note)>
Iterate notes in numeric step-index order. BTreeMap iterates
string keys lexicographically, which would put “12” before “2”;
we collect and re-sort by the parsed usize instead. Consumed by
the TUI A list overlay and by the export writers (md / html /
json) for their per-step note sections.
Sourcepub fn load_for(session_path: &Path) -> Self
pub fn load_for(session_path: &Path) -> Self
Load annotations for a session from disk. Returns an empty set (not an error) when the file doesn’t exist — the common case for sessions the user hasn’t annotated yet.
A corrupted / malformed notes file also returns empty rather than erroring, so one bad file doesn’t prevent the TUI from launching. A stderr warning is emitted so users know to look.
Trait Implementations§
Source§impl Clone for Annotations
impl Clone for Annotations
Source§fn clone(&self) -> Annotations
fn clone(&self) -> Annotations
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Annotations
impl Debug for Annotations
Source§impl Default for Annotations
impl Default for Annotations
Source§fn default() -> Annotations
fn default() -> Annotations
Source§impl<'de> Deserialize<'de> for Annotations
impl<'de> Deserialize<'de> for Annotations
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>,
Auto Trait Implementations§
impl Freeze for Annotations
impl RefUnwindSafe for Annotations
impl Send for Annotations
impl Sync for Annotations
impl Unpin for Annotations
impl UnsafeUnpin for Annotations
impl UnwindSafe for Annotations
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<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