html_sys/text/
wbr.rs

1/// The HTML `<wbr>` element
2///
3/// [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/wbr)
4#[doc(alias = "wbr")]
5#[non_exhaustive]
6#[derive(Debug, Clone, PartialEq, Default)]
7pub struct LineBreakOpportunity {
8    pub data_map: crate::DataMap,
9    global_attrs: crate::GlobalAttributes,
10    /// Describes the role(s) the current element plays in the context of the document.
11    pub role: std::option::Option<std::borrow::Cow<'static, str>>,
12    /// Indicates whether the element is exposed to an accessibility API. See related aria-disabled.
13    pub aria_hidden: bool,
14}
15impl crate::RenderElement for LineBreakOpportunity {
16    fn write_opening_tag<W: std::fmt::Write>(&self, writer: &mut W) -> std::fmt::Result {
17        write!(writer, "<wbr")?;
18        if let Some(field) = self.role.as_ref() {
19            write!(writer, r#" role="{field}""#)?;
20        }
21        if self.aria_hidden {
22            write!(writer, r#" aria-hidden"#)?;
23        }
24        write!(writer, "{}", self.global_attrs)?;
25        write!(writer, "{}", self.data_map)?;
26        write!(writer, ">")?;
27        Ok(())
28    }
29    #[allow(unused_variables)]
30    fn write_closing_tag<W: std::fmt::Write>(&self, writer: &mut W) -> std::fmt::Result {
31        Ok(())
32    }
33}
34impl std::fmt::Display for LineBreakOpportunity {
35    fn fmt(&self, writer: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
36        use crate::RenderElement;
37        self.write_opening_tag(writer)?;
38        self.write_closing_tag(writer)?;
39        Ok(())
40    }
41}
42impl std::ops::Deref for LineBreakOpportunity {
43    type Target = crate::GlobalAttributes;
44    fn deref(&self) -> &Self::Target {
45        &self.global_attrs
46    }
47}
48impl std::ops::DerefMut for LineBreakOpportunity {
49    fn deref_mut(&mut self) -> &mut Self::Target {
50        &mut self.global_attrs
51    }
52}