pub struct History {
pub entries: Vec<HistoryEntry>,
}Expand description
The append-only event log of an issue (data-model.md §8).
Append-only is a hard guarantee of this type: the only mutating operation
is History::append. There is deliberately no remove, no reorder, no
trim, and no compaction — those are out of scope, but the container is
shaped so a future retention policy has a seam.
Fields§
§entries: Vec<HistoryEntry>Every line of the section, in file order, which is append order.
Held as an ordered list of entries rather than a flat Vec<HistoryEvent>
so an unparseable line keeps its position and its exact text. That
is what lets the section round-trip byte-stably without ever dropping or
repairing a line a human hand-edited.
Implementations§
Source§impl History
impl History
Sourcepub fn append(&mut self, event: HistoryEvent)
pub fn append(&mut self, event: HistoryEvent)
Append one event. Never rewrites, reorders, or removes an existing line.
Sourcepub fn append_now(&mut self, actor: &str, kind: HistoryEventKind, detail: &str)
pub fn append_now(&mut self, actor: &str, kind: HistoryEventKind, detail: &str)
Append with the current UTC timestamp.
Sourcepub fn events(&self) -> Vec<&HistoryEvent>
pub fn events(&self) -> Vec<&HistoryEvent>
The parsed events, in file order.
Unparseable lines are excluded here; see History::unparsed.
Sourcepub fn unparsed(&self) -> Vec<&str>
pub fn unparsed(&self) -> Vec<&str>
Lines that could not be parsed, verbatim and in file order.
Non-empty means the section was hand-edited into a shape this parser
does not accept. tix lint reports each as a history
finding; nothing else treats it as an error.
Sourcepub fn render(&self) -> String
pub fn render(&self) -> String
Render the section, including its heading and the blank line after it.
An empty log renders to the empty string, so the section is omitted from the file entirely rather than written as an empty heading. An unparseable line is re-emitted exactly as it was read, in place, so a read/write cycle is byte-stable whether or not the section is clean.
Sourcepub fn parse_front(body: &str) -> (Self, String)
pub fn parse_front(body: &str) -> (Self, String)
Parse a leading ## History section, returning the log and whatever body
text followed it.
Only a section at the front of the body is recognised, matching the
position data-model.md §8 pins (immediately after the frontmatter). A
## History heading appearing later in the prose is left alone as
ordinary body text.
The section ends at the first line that is neither blank nor a list item, so a blank line between entries does not end it — a blank line inside a list is the most ordinary thing a human or a Markdown formatter produces, and terminating there would silently demote audit entries to body prose and reorder the log. Unparseable list items are kept verbatim rather than failing the file.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for History
impl<'de> Deserialize<'de> for History
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>,
impl Eq for History
impl StructuralPartialEq for History
Auto Trait Implementations§
impl Freeze for History
impl RefUnwindSafe for History
impl Send for History
impl Sync for History
impl Unpin for History
impl UnsafeUnpin for History
impl UnwindSafe for History
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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