pub struct DocEntry(/* private fields */);Expand description
A flexible document entry that serializes as a flat JSON object.
Each entry has a "phase": "runtime" field set automatically.
Implementations§
Source§impl DocEntry
impl DocEntry
Sourcepub fn code(label: &str, content: &str, lang: Option<&str>) -> Self
pub fn code(label: &str, content: &str, lang: Option<&str>) -> Self
A code block with optional language.
Sourcepub fn json_doc(label: &str, value: &impl Serialize) -> Self
pub fn json_doc(label: &str, value: &impl Serialize) -> Self
A JSON document rendered as a code block with lang=json.
Sourcepub fn table(label: &str, columns: &[&str], rows: &[&[&str]]) -> Self
pub fn table(label: &str, columns: &[&str], rows: &[&[&str]]) -> Self
A table with columns and rows.
Sourcepub fn screenshot(path: &str, alt: Option<&str>) -> Self
pub fn screenshot(path: &str, alt: Option<&str>) -> Self
A screenshot reference.
Sourcepub fn video(path: &str, caption: Option<&str>, poster: Option<&str>) -> Self
pub fn video(path: &str, caption: Option<&str>, poster: Option<&str>) -> Self
A video, played inline in HTML reports. poster is the still shown
before playback.
Sourcepub fn html(opts: HtmlOptions<'_>) -> Self
pub fn html(opts: HtmlOptions<'_>) -> Self
Embedded HTML rendered inside an always-sandboxed iframe.
§Panics
Panics unless exactly one of path, url, or content is set.
Sourcepub fn state(label: Option<&str>, value: Value) -> Self
pub fn state(label: Option<&str>, value: Value) -> Self
A state snapshot captured at a step (data storyboard frame).
value is a JSON-serializable snapshot of “what the world looks like”
at this step; consecutive states with the same label are diffed by the
report renderer. None (or an empty label) omits the label field
(anonymous state lane).
Sourcepub fn custom(type_name: &str, data: Value) -> Self
pub fn custom(type_name: &str, data: Value) -> Self
A custom doc entry with arbitrary type and data.
Sourcepub fn with_children(self, children: Vec<DocEntry>) -> Self
pub fn with_children(self, children: Vec<DocEntry>) -> Self
Add children to this doc entry.