Structuresliemeobn.elementary 0.3.1Elementary
HTMLElement
An HTML element that can contain content.
Html+Elements.swift:2struct HTMLElement<Tag, Content> where Tag : HTMLTrait.Paired, Content : HTML
Citizens in Elementary
Conformances
protocol HTML<Tag>
A type that represents HTML content that can be rendered.
Typealiases
typealias Tag
The type of the HTML tag this element represents.
Type members
init(HTMLAttribute<Tag>, content: () -> Content
) Creates a new HTML element with the specified attribute and content.
init(HTMLAttribute<Tag>..., content: () -> Content
) Creates a new HTML element with the specified attributes and content.
init(attributes: [HTMLAttribute<Tag>], content: () -> Content
) Creates a new HTML element with the specified attributes and content.
init(content: () -> Content
) Creates a new HTML element with the specified content.
Show system interfaces (2)
Hide system interfaces
Instance members
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(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.
Show obsolete interfaces (1)
Hide obsolete interfaces
Citizens in Elementary
where Content:HTML, Content:Sendable, Tag:HTMLTrait.Paired
Conformances
protocol Sendable
A type whose values can safely be passed across concurrency domains by copying.
Citizens in Elementary
where Content:HTML, Tag:HTMLTrait.Paired
Type members
init<AwaitedContent>(HTMLAttribute<Tag>..., content: @escaping () async throws -> AwaitedContent
) Creates a new HTML element with the specified tag and async content.
init<AwaitedContent>(attributes: [HTMLAttribute<Tag>], content: @escaping () async throws -> AwaitedContent
) Creates a new HTML element with the specified tag and async content.