polished_css/selector/
id.rs1use std::fmt::{Display, Formatter, Result};
2
3use super::SelectorDisplay;
4
5#[derive(Clone, Debug, PartialEq)]
6pub struct Id(pub String);
7
8impl SelectorDisplay for Id {
9 fn as_styles_content(&self) -> String {
10 self.to_string()
11 }
12
13 fn as_attribute_value(&self) -> String {
14 self.to_string()
15 }
16}
17
18impl Display for Id {
19 fn fmt(&self, f: &mut Formatter<'_>) -> Result {
20 write!(f, "#{}", self.0)
21 }
22}
23
24impl From<&str> for Id {
25 fn from(value: &str) -> Self {
26 Self(value.to_string())
27 }
28}