pub struct RenderInput<'a> {
pub date: &'a str,
pub title: &'a str,
pub why: &'a str,
pub rejected: Option<&'a str>,
pub risk: Option<&'a str>,
pub tags: &'a [String],
}Expand description
Inputs needed to render an entry block.
Kept as a borrow-everything struct so the call site reads cleanly and
new optional fields can be added in future versions without breaking
callers (they’d compile-error on the missing field and add None).
§Example
use logbook::{render_entry_block, RenderInput};
let tags = vec!["refactor".to_string()];
let block = render_entry_block(&RenderInput {
date: "2026-05-16",
title: "switched ORM",
why: "perf",
rejected: None,
risk: None,
tags: &tags,
});
assert!(block.starts_with("## 2026-05-16 — switched ORM\n"));Fields§
§date: &'a strDate string, conventionally YYYY-MM-DD. Not validated by the
renderer — pass crate::today if you want today’s date.
title: &'a strShort single-line title.
why: &'a strThe mandatory why field — the reason for the decision.
rejected: Option<&'a str>Optional rejected field — alternatives considered and why not.
Empty or whitespace-only strings are omitted from the output.
risk: Option<&'a str>Optional risk field — what could go wrong.
Empty or whitespace-only strings are omitted from the output.
Tags to attach. Per-tag whitespace is trimmed and empty entries are dropped before rendering. An empty slice omits the tags line.
Trait Implementations§
Source§impl<'a> Clone for RenderInput<'a>
impl<'a> Clone for RenderInput<'a>
Source§fn clone(&self) -> RenderInput<'a>
fn clone(&self) -> RenderInput<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more