Skip to main content

reflexo/vector/ir/
html.rs

1use super::preludes::*;
2
3/// Item representing a sized html element in frames.
4#[derive(Debug, Clone, Hash, PartialEq, Eq)]
5#[cfg_attr(feature = "rkyv", derive(Archive, rDeser, rSer))]
6#[cfg_attr(feature = "rkyv-validation", archive(check_bytes))]
7pub struct SizedRawHtmlItem {
8    /// The sanitized source code.
9    pub html: ImmutStr,
10    /// The target size of the image.
11    pub size: Size,
12}
13
14/// Item representing a html element in frames.
15#[derive(Debug, Clone, Hash, PartialEq, Eq)]
16#[cfg_attr(feature = "rkyv", derive(Archive, rDeser, rSer))]
17#[cfg_attr(feature = "rkyv-validation", archive(check_bytes))]
18pub struct HtmlItem {
19    /// The tag of the html element.
20    pub tag: ImmutStr,
21    /// The attributes of the html element.
22    pub attrs: Vec<(ImmutStr, ImmutStr)>,
23    /// The sanitized source code.
24    pub children: Vec<HtmlChildren>,
25}
26
27/// Item representing a html element in frames.
28#[derive(Debug, Clone, Hash, PartialEq, Eq)]
29#[cfg_attr(feature = "rkyv", derive(Archive, rDeser, rSer))]
30#[cfg_attr(feature = "rkyv-validation", archive(check_bytes))]
31pub enum HtmlChildren {
32    /// A embedded vec item.
33    Item(Fingerprint),
34    /// Plain text.
35    Text(ImmutStr),
36}