pub struct Entry {
pub ts: String,
pub event: String,
pub head: String,
pub branch: String,
pub by: String,
pub session: Option<String>,
pub payload: BTreeMap<String, Value>,
}Expand description
One line of the record, as a reader sees it.
The envelope is typed and the payload is left as it was written: a reader of one event knows its own keys, and this type may not grow a field every time an event does.
use majordomus_cli::ledger::Entry;
let e: Entry = serde_json::from_str(
r#"{"ts":"2026-09-11T12:00:00Z","event":"plan_done","head":"abc","branch":"master",
"by":"majordomus/0.5.0","issue":"I0001"}"#).unwrap();
assert_eq!(e.event, "plan_done");
assert!(e.session.is_none(), "no episode was open when this was written");
// Everything the envelope does not name stays in the payload, whatever the event is.
assert_eq!(e.payload["issue"], "I0001");Fields§
§ts: StringWhen it happened.
event: StringThe event name, from the vocabulary.
head: StringThe commit the checkout was at.
branch: StringThe branch it was on.
by: StringWhat wrote it: majordomus/<version>.
session: Option<String>The episode it belongs to, when there was one.
payload: BTreeMap<String, Value>Everything else the line carried.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Entry
impl<'de> Deserialize<'de> for Entry
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
Auto Trait Implementations§
impl Freeze for Entry
impl RefUnwindSafe for Entry
impl Send for Entry
impl Sync for Entry
impl Unpin for Entry
impl UnsafeUnpin for Entry
impl UnwindSafe for Entry
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
Mutably borrows from an owned value. Read more