Examples

Runnable programs from the model crate’s examples/ directory. Each is a tutorial in its header comment and a complete program below it; run one from a checkout with cargo run --example <name> (some need extra cargo features — the page says which).

  • build_patient — Build a FHIR R5 Patient with the generated builder and serialize it
  • client_crud — FHIR REST client CRUD against the public HAPI test server (feature client)
  • code_systems — Use FHIR R5 code systems as type-safe Rust enums
  • convert_release — Convert a resource between FHIR releases, and read the loss report
  • extensions — Read and write FHIR extensions ergonomically with ExtensionExt
  • operation_outcome — Turn validation results into a FHIR OperationOutcome
  • primitive_extensions — Read and write FHIR primitive extensions — the _field siblings
  • r3_patient — Build a FHIR R3 Patient, serialize it, validate it, and read it back
  • r4_and_r5_side_by_side — Use the R4 and R5 models in one program, and convert between them
  • r4_patient — Build a FHIR R4 Patient, serialize it, validate it, and read it back
  • read_bundle — Read a FHIR R5 Bundle and dispatch on each entry's resource type
  • search_response — Consume a FHIR search response: typed entries, the total, and paging
  • transaction_bundle — Build a FHIR transaction Bundle and read resources back out of one
  • tutorial — The guide's end-to-end tutorial, as a runnable program
  • validate_resource — Validate FHIR R5 values with the [Validate] trait

The database family’s worked examples are a guide of their own: Examples.

Edit this page on GitHub — the repository is the source of truth; this site renders it.