#[repr(u8)]pub enum Tag {
Show 59 variants
Area = 0,
Base = 1,
Br = 2,
Col = 3,
Embed = 4,
Hr = 5,
Img = 6,
Input = 7,
Link = 8,
Meta = 9,
Param = 10,
Source = 11,
Track = 12,
Wbr = 13,
A = 14,
Abbr = 15,
Article = 16,
Aside = 17,
B = 18,
Body = 19,
Button = 20,
Div = 21,
Em = 22,
Footer = 23,
Form = 24,
H1 = 25,
H2 = 26,
H3 = 27,
H4 = 28,
H5 = 29,
H6 = 30,
Head = 31,
Header = 32,
Html = 33,
I = 34,
Iframe = 35,
Li = 36,
Main = 37,
Nav = 38,
Ol = 39,
P = 40,
Pre = 41,
Script = 42,
Section = 43,
Select = 44,
Span = 45,
Strong = 46,
Style = 47,
Table = 48,
Tbody = 49,
Td = 50,
Textarea = 51,
Th = 52,
Thead = 53,
Title = 54,
Tr = 55,
Ul = 56,
Video = 57,
Unknown = 255,
}Expand description
Interned HTML tag enum.
Known HTML tag names interned as a u8 discriminant.
Comparison becomes a single integer compare instead of a string compare.
The first 14 variants (0..14) are void elements — is_void() exploits this
for a branch-free check.
Variants§
Area = 0
<area>
Base = 1
<base>
Br = 2
<br>
Col = 3
<col>
Embed = 4
<embed>
Hr = 5
<hr>
Img = 6
<img>
Input = 7
<input>
Link = 8
<link>
Meta = 9
<meta>
Param = 10
<param>
Source = 11
<source>
Track = 12
<track>
Wbr = 13
<wbr>
A = 14
<a>
Abbr = 15
<abbr>
Article = 16
<article>
Aside = 17
<aside>
B = 18
<b>
Body = 19
<body>
Button = 20
<button>
Div = 21
<div>
Em = 22
<em>
<footer>
Form = 24
<form>
H1 = 25
<h1>
H2 = 26
<h2>
H3 = 27
<h3>
H4 = 28
<h4>
H5 = 29
<h5>
H6 = 30
<h6>
Head = 31
<head>
Header = 32
<header>
Html = 33
<html>
I = 34
<i>
Iframe = 35
<iframe>
Li = 36
<li>
Main = 37
<main>
<nav>
Ol = 39
<ol>
P = 40
<p>
Pre = 41
<pre>
Script = 42
<script>
Section = 43
<section>
Select = 44
<select>
Span = 45
<span>
Strong = 46
<strong>
Style = 47
<style>
Table = 48
<table>
Tbody = 49
<tbody>
Td = 50
<td>
Textarea = 51
<textarea>
Th = 52
<th>
Thead = 53
<thead>
Title = 54
<title>
Tr = 55
<tr>
Ul = 56
<ul>
Video = 57
<video>
Unknown = 255
Any tag name not in the known set.
Implementations§
Source§impl Tag
impl Tag
Sourcepub fn from_bytes(name: &[u8]) -> Tag
pub fn from_bytes(name: &[u8]) -> Tag
Look up a tag by its raw byte name using a compile-time perfect hash.
Case-insensitive: the input is lowercased inline on a stack buffer before the PHF lookup, avoiding any heap allocation.
Sourcepub const fn is_void(self) -> bool
pub const fn is_void(self) -> bool
Returns true if this is a void element (self-closing, no children).
Branch-free: exploits the fact that void elements occupy discriminants
0..14.
Sourcepub const fn is_raw_text(self) -> bool
pub const fn is_raw_text(self) -> bool
Returns true if this is a raw text element (<script>, <style>).
Raw text elements’ content must not be entity-escaped during serialization, and the tokenizer enters a special raw-text mode for them.
Sourcepub const fn as_str(self) -> Option<&'static str>
pub const fn as_str(self) -> Option<&'static str>
Returns the canonical lowercase tag name, or None for Tag::Unknown.