Expand description
Content trait dispatch — render any ValueWord value as a ContentNode.
The render_as_content function implements the Content trait dispatch logic:
- If the value IS already a ContentNode → return as-is
- Match by NanTag/HeapValue type → built-in Content impls for primitives
- Fallback → Display as ContentNode::plain(display_string)
Built-in Content implementations:
- string → ContentNode::plain(self)
- number/int/decimal → ContentNode::plain(formatted)
- bool → ContentNode::plain(“true”/“false”)
- Vec
→ ContentNode::Table with columns from schema fields - Vec
→ ContentNode::plain(“[1, 2, 3]”) - HashMap<K,V> → ContentNode::KeyValue
- TypedObject → ContentNode::KeyValue with field names from schema
§ContentFor
The render_as_content_for function adds adapter-aware dispatch:
- ContentFor
→ adapter-specific rendering - Content → generic content rendering
- Display fallback → plain text
Adapter types: Terminal, Html, Markdown, Json, Plain
Modules§
- adapters
- Well-known adapter names for ContentFor
dispatch.
Functions§
- capabilities_
for_ adapter - Create a RendererCapabilities descriptor for a given adapter name.
- datatable_
to_ content_ node - Convert a DataTable (Arrow RecordBatch wrapper) to a ContentNode::Table.
- render_
as_ content - Render a ValueWord value as a ContentNode using Content dispatch.
- render_
as_ content_ for - set_
user_ content_ for_ resolver - Register a user-defined ContentFor
resolver. - set_
user_ content_ resolver - Register a user-defined Content trait resolver.
Type Aliases§
- User
Content ForResolver - Render a ValueWord value as a ContentNode with adapter-specific dispatch.
- User
Content Resolver - Optional user-defined Content impl resolver.