Structuresliemeobn.elementary 0.3.3Elementary
AsyncContent
An element that awaits its content before rendering.
AsyncContent.swift:5struct AsyncContent<Content> where Content : HTML
The this element can only be rendered in an async context (ie: by calling render(into:chunkSize:)
or renderAsync
). All HTML tag types (HTMLElement
) support async content closures in their initializers, so you don’t need to use this element directly in most cases.
Citizens in Elementary
Conformances
protocol HTML<Tag>
A type that represents HTML content that can be rendered.
protocol Sendable
A type whose values can safely be passed across concurrency domains by copying.
Typealiases
Type members
init(content: @escaping () async throws -> Content
) Creates a new async HTML element with the specified content.
Show system interfaces (2)
Hide system interfaces
Type features
Show implementation details (2)
Hide implementation details
Instance features
func attributes(HTMLAttribute<Tag>, when: Bool
) -> _AttributedElement<Self> Adds the specified attribute to the element.
func attributes(HTMLAttribute<Tag>..., when: Bool
) -> _AttributedElement<Self> Adds the specified attributes to the element.
func attributes(contentsOf: [HTMLAttribute<Tag>], when: Bool
) -> _AttributedElement<Self> Adds the specified attributes to the element.
func environment<T>(TaskLocal<T>, T
) -> _ModifiedTaskLocal<T, Self> Sets the value of a
TaskLocal
for the duration of rendering the content.func render(
) -> String Renders the HTML content into a single string.
func render(into: some HTMLStreamWriter, chunkSize: Int
) async throws Renders the HTML content into a stream writer.
func renderAsync(
) async throws -> String Renders the HTML content into a single string asynchronously.
func renderFormatted(
) -> String Renders the HTML content into a formatted string.