html_types/semantic/
stylesheet.rs

1use crate::{
2    css::CascadingStyleSheet,
3    node::{Element, Node},
4    text::Text,
5    url::Url,
6};
7
8pub enum StyleSheet {
9    External(Url),
10    Inline(CascadingStyleSheet),
11}
12
13impl<'a> From<StyleSheet> for Node<'a> {
14    fn from(value: StyleSheet) -> Self {
15        match value {
16            StyleSheet::External(url) => {
17                let el = Element::external_style(url);
18                el.into()
19            }
20            StyleSheet::Inline(string) => {
21                let el = Element::inline_style(Text::create(string));
22                el.into()
23            }
24        }
25    }
26}