diff --git a/execution_graph/README.md b/execution_graph/README.md index 9847098..2edd2eb 100644 --- a/execution_graph/README.md +++ b/execution_graph/README.md @@ -52,8 +52,8 @@ fn main() -> Result<(), Box> { let program = Arc::new(builder.build_verified()?); let mut graph = ExecutionGraph::new(NoHost, Limits::default()); - let node = graph.add_node(program, entry, vec!["x".into()]); - graph.set_input_value(node, "x", Value::I64(41)); + let node = graph.add_node(program, entry, vec!["x".into()])?; + graph.set_input_value(node, "x", Value::I64(41))?; let summary = graph.run_all()?; assert_eq!(summary.executed_nodes, 1); diff --git a/execution_graph/src/lib.rs b/execution_graph/src/lib.rs index 5dd36c5..c613616 100644 --- a/execution_graph/src/lib.rs +++ b/execution_graph/src/lib.rs @@ -86,3 +86,13 @@ mod tape_access; pub use access::{Access, AccessLog, HostOpId, NodeId, ResourceKey}; pub use graph::{ExecutionGraph, GraphError, NodeOutputs}; pub use report::{NodeRunDetail, ReportDetailMask, RunDetailReport, RunSummary}; + +/// Compiles the `README.md` code blocks as doctests so the Quick Start cannot +/// drift out of sync with the API. +/// +/// This item exists only under `cfg(doctest)` (set while `cargo test --doc` +/// extracts doctests), so it is never built into the crate and never appears in +/// the rendered documentation. +#[cfg(doctest)] +#[doc = include_str!("../README.md")] +struct ReadmeDoctests; diff --git a/execution_tape/src/lib.rs b/execution_tape/src/lib.rs index 798ec91..559e93f 100644 --- a/execution_tape/src/lib.rs +++ b/execution_tape/src/lib.rs @@ -86,3 +86,13 @@ pub(crate) mod typed; pub mod value; pub mod verifier; pub mod vm; + +/// Compiles the `README.md` code blocks as doctests so the Quick Start cannot +/// drift out of sync with the API. +/// +/// This item exists only under `cfg(doctest)` (set while `cargo test --doc` +/// extracts doctests), so it is never built into the crate and never appears in +/// the rendered documentation. +#[cfg(doctest)] +#[doc = include_str!("../README.md")] +struct ReadmeDoctests;