htmy.renderer.typing
RendererType
Bases:
Protocol definition for renderers.
Source code in htmy/renderer/typing.py
render(component, context=None)
async
Renders the given component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
|
The component to render. |
required |
context
|
|
An optional rendering context. |
None
|
Returns:
| Type | Description |
|---|---|
|
The rendered string. |
Source code in htmy/renderer/typing.py
StreamingRendererType
Bases: ,
Protocol definition for streaming renderers.
Source code in htmy/renderer/typing.py
stream(component, context=None)
Async iterator that renders the given component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
|
The component to render. |
required |
context
|
|
An optional rendering context. |
None
|
Yields:
| Type | Description |
|---|---|
|
The rendered strings. |
Source code in htmy/renderer/typing.py
is_renderer(obj)
Type guard that checks if the given object is a renderer.
is_streaming_renderer(obj)
Type guard that checks if the given object is a streaming renderer.