#[derive(Clone, Debug, PartialEq)]
pub enum TagKind {
Part(Tag<kind::Part>),
Article(Tag<kind::Article>),
Section(Tag<kind::Section>),
Div(Tag<kind::Div>),
BlockQuote(Tag<kind::BlockQuote>),
Caption(Tag<kind::Caption>),
TOC(Tag<kind::TOC>),
TOCI(Tag<kind::TOCI>),
Index(Tag<kind::Index>),
P(Tag<kind::P>),
Hn(Tag<kind::Hn>),
L(Tag<kind::L>),
LI(Tag<kind::LI>),
Lbl(Tag<kind::Lbl>),
LBody(Tag<kind::LBody>),
Table(Tag<kind::Table>),
TR(Tag<kind::TR>),
TH(Tag<kind::TH>),
TD(Tag<kind::TD>),
THead(Tag<kind::THead>),
TBody(Tag<kind::TBody>),
TFoot(Tag<kind::TFoot>),
Span(Tag<kind::Span>),
InlineQuote(Tag<kind::InlineQuote>),
Note(Tag<kind::Note>),
Reference(Tag<kind::Reference>),
BibEntry(Tag<kind::BibEntry>),
Code(Tag<kind::Code>),
Link(Tag<kind::Link>),
Annot(Tag<kind::Annot>),
Figure(Tag<kind::Figure>),
Formula(Tag<kind::Formula>),
Form(Tag<kind::Form>),
NonStruct(Tag<kind::NonStruct>),
Datetime(Tag<kind::Datetime>),
Terms(Tag<kind::Terms>),
Title(Tag<kind::Title>),
Strong(Tag<kind::Strong>),
Em(Tag<kind::Em>),
}
impl TagKind {
pub fn as_any(&self) -> &AnyTag {
match self {
Self::Part(tag) => tag.as_any(),
Self::Article(tag) => tag.as_any(),
Self::Section(tag) => tag.as_any(),
Self::Div(tag) => tag.as_any(),
Self::BlockQuote(tag) => tag.as_any(),
Self::Caption(tag) => tag.as_any(),
Self::TOC(tag) => tag.as_any(),
Self::TOCI(tag) => tag.as_any(),
Self::Index(tag) => tag.as_any(),
Self::P(tag) => tag.as_any(),
Self::Hn(tag) => tag.as_any(),
Self::L(tag) => tag.as_any(),
Self::LI(tag) => tag.as_any(),
Self::Lbl(tag) => tag.as_any(),
Self::LBody(tag) => tag.as_any(),
Self::Table(tag) => tag.as_any(),
Self::TR(tag) => tag.as_any(),
Self::TH(tag) => tag.as_any(),
Self::TD(tag) => tag.as_any(),
Self::THead(tag) => tag.as_any(),
Self::TBody(tag) => tag.as_any(),
Self::TFoot(tag) => tag.as_any(),
Self::Span(tag) => tag.as_any(),
Self::InlineQuote(tag) => tag.as_any(),
Self::Note(tag) => tag.as_any(),
Self::Reference(tag) => tag.as_any(),
Self::BibEntry(tag) => tag.as_any(),
Self::Code(tag) => tag.as_any(),
Self::Link(tag) => tag.as_any(),
Self::Annot(tag) => tag.as_any(),
Self::Figure(tag) => tag.as_any(),
Self::Formula(tag) => tag.as_any(),
Self::Form(tag) => tag.as_any(),
Self::NonStruct(tag) => tag.as_any(),
Self::Datetime(tag) => tag.as_any(),
Self::Terms(tag) => tag.as_any(),
Self::Title(tag) => tag.as_any(),
Self::Strong(tag) => tag.as_any(),
Self::Em(tag) => tag.as_any(),
}
}
pub fn as_any_mut(&mut self) -> &mut AnyTag {
match self {
Self::Part(tag) => tag.as_any_mut(),
Self::Article(tag) => tag.as_any_mut(),
Self::Section(tag) => tag.as_any_mut(),
Self::Div(tag) => tag.as_any_mut(),
Self::BlockQuote(tag) => tag.as_any_mut(),
Self::Caption(tag) => tag.as_any_mut(),
Self::TOC(tag) => tag.as_any_mut(),
Self::TOCI(tag) => tag.as_any_mut(),
Self::Index(tag) => tag.as_any_mut(),
Self::P(tag) => tag.as_any_mut(),
Self::Hn(tag) => tag.as_any_mut(),
Self::L(tag) => tag.as_any_mut(),
Self::LI(tag) => tag.as_any_mut(),
Self::Lbl(tag) => tag.as_any_mut(),
Self::LBody(tag) => tag.as_any_mut(),
Self::Table(tag) => tag.as_any_mut(),
Self::TR(tag) => tag.as_any_mut(),
Self::TH(tag) => tag.as_any_mut(),
Self::TD(tag) => tag.as_any_mut(),
Self::THead(tag) => tag.as_any_mut(),
Self::TBody(tag) => tag.as_any_mut(),
Self::TFoot(tag) => tag.as_any_mut(),
Self::Span(tag) => tag.as_any_mut(),
Self::InlineQuote(tag) => tag.as_any_mut(),
Self::Note(tag) => tag.as_any_mut(),
Self::Reference(tag) => tag.as_any_mut(),
Self::BibEntry(tag) => tag.as_any_mut(),
Self::Code(tag) => tag.as_any_mut(),
Self::Link(tag) => tag.as_any_mut(),
Self::Annot(tag) => tag.as_any_mut(),
Self::Figure(tag) => tag.as_any_mut(),
Self::Formula(tag) => tag.as_any_mut(),
Self::Form(tag) => tag.as_any_mut(),
Self::NonStruct(tag) => tag.as_any_mut(),
Self::Datetime(tag) => tag.as_any_mut(),
Self::Terms(tag) => tag.as_any_mut(),
Self::Title(tag) => tag.as_any_mut(),
Self::Strong(tag) => tag.as_any_mut(),
Self::Em(tag) => tag.as_any_mut(),
}
}
pub fn id(&self) -> Option<&TagId> {
self.as_any().id()
}
pub fn set_id(&mut self, id: Option<TagId>) {
self.as_any_mut().set_id(id);
}
pub fn with_id(mut self, id: Option<TagId>) -> Self {
self.set_id(id);
self
}
pub fn lang(&self) -> Option<&str> {
self.as_any().lang()
}
pub fn set_lang(&mut self, lang: Option<String>) {
self.as_any_mut().set_lang(lang);
}
pub fn with_lang(mut self, lang: Option<String>) -> Self {
self.set_lang(lang);
self
}
pub fn alt_text(&self) -> Option<&str> {
self.as_any().alt_text()
}
pub fn set_alt_text(&mut self, alt_text: Option<String>) {
self.as_any_mut().set_alt_text(alt_text);
}
pub fn with_alt_text(mut self, alt_text: Option<String>) -> Self {
self.set_alt_text(alt_text);
self
}
pub fn expanded(&self) -> Option<&str> {
self.as_any().expanded()
}
pub fn set_expanded(&mut self, expanded: Option<String>) {
self.as_any_mut().set_expanded(expanded);
}
pub fn with_expanded(mut self, expanded: Option<String>) -> Self {
self.set_expanded(expanded);
self
}
pub fn actual_text(&self) -> Option<&str> {
self.as_any().actual_text()
}
pub fn set_actual_text(&mut self, actual_text: Option<String>) {
self.as_any_mut().set_actual_text(actual_text);
}
pub fn with_actual_text(mut self, actual_text: Option<String>) -> Self {
self.set_actual_text(actual_text);
self
}
pub fn title(&self) -> Option<&str> {
self.as_any().title()
}
pub fn level(&self) -> Option<NonZeroU16> {
self.as_any().level()
}
pub fn numbering(&self) -> Option<ListNumbering> {
self.as_any().numbering()
}
pub fn summary(&self) -> Option<&str> {
self.as_any().summary()
}
pub fn scope(&self) -> Option<TableHeaderScope> {
self.as_any().scope()
}
pub fn headers(&self) -> Option<&[TagId]> {
self.as_any().headers()
}
pub fn row_span(&self) -> Option<NonZeroU32> {
self.as_any().row_span()
}
pub fn col_span(&self) -> Option<NonZeroU32> {
self.as_any().col_span()
}
pub fn placement(&self) -> Option<Placement> {
self.as_any().placement()
}
pub fn set_placement(&mut self, placement: Option<Placement>) {
self.as_any_mut().set_placement(placement);
}
pub fn with_placement(mut self, placement: Option<Placement>) -> Self {
self.set_placement(placement);
self
}
pub fn writing_mode(&self) -> Option<WritingMode> {
self.as_any().writing_mode()
}
pub fn set_writing_mode(&mut self, writing_mode: Option<WritingMode>) {
self.as_any_mut().set_writing_mode(writing_mode);
}
pub fn with_writing_mode(mut self, writing_mode: Option<WritingMode>) -> Self {
self.set_writing_mode(writing_mode);
self
}
pub fn bbox(&self) -> Option<BBox> {
self.as_any().bbox()
}
pub fn width(&self) -> Option<f32> {
self.as_any().width()
}
pub fn height(&self) -> Option<f32> {
self.as_any().height()
}
pub fn background_color(&self) -> Option<NaiveRgbColor> {
self.as_any().background_color()
}
pub fn set_background_color(&mut self, background_color: Option<NaiveRgbColor>) {
self.as_any_mut().set_background_color(background_color);
}
pub fn with_background_color(mut self, background_color: Option<NaiveRgbColor>) -> Self {
self.set_background_color(background_color);
self
}
pub fn border_color(&self) -> Option<Sides<NaiveRgbColor>> {
self.as_any().border_color()
}
pub fn set_border_color(&mut self, border_color: Option<Sides<NaiveRgbColor>>) {
self.as_any_mut().set_border_color(border_color);
}
pub fn with_border_color(mut self, border_color: Option<Sides<NaiveRgbColor>>) -> Self {
self.set_border_color(border_color);
self
}
pub fn border_style(&self) -> Option<Sides<BorderStyle>> {
self.as_any().border_style()
}
pub fn set_border_style(&mut self, border_style: Option<Sides<BorderStyle>>) {
self.as_any_mut().set_border_style(border_style);
}
pub fn with_border_style(mut self, border_style: Option<Sides<BorderStyle>>) -> Self {
self.set_border_style(border_style);
self
}
pub fn border_thickness(&self) -> Option<Sides<f32>> {
self.as_any().border_thickness()
}
pub fn set_border_thickness(&mut self, border_thickness: Option<Sides<f32>>) {
self.as_any_mut().set_border_thickness(border_thickness);
}
pub fn with_border_thickness(mut self, border_thickness: Option<Sides<f32>>) -> Self {
self.set_border_thickness(border_thickness);
self
}
pub fn padding(&self) -> Option<Sides<f32>> {
self.as_any().padding()
}
pub fn set_padding(&mut self, padding: Option<Sides<f32>>) {
self.as_any_mut().set_padding(padding);
}
pub fn with_padding(mut self, padding: Option<Sides<f32>>) -> Self {
self.set_padding(padding);
self
}
pub fn color(&self) -> Option<NaiveRgbColor> {
self.as_any().color()
}
pub fn set_color(&mut self, color: Option<NaiveRgbColor>) {
self.as_any_mut().set_color(color);
}
pub fn with_color(mut self, color: Option<NaiveRgbColor>) -> Self {
self.set_color(color);
self
}
pub fn space_before(&self) -> Option<f32> {
self.as_any().space_before()
}
pub fn space_after(&self) -> Option<f32> {
self.as_any().space_after()
}
pub fn start_indent(&self) -> Option<f32> {
self.as_any().start_indent()
}
pub fn end_indent(&self) -> Option<f32> {
self.as_any().end_indent()
}
pub fn text_indent(&self) -> Option<f32> {
self.as_any().text_indent()
}
pub fn text_align(&self) -> Option<TextAlign> {
self.as_any().text_align()
}
pub fn block_align(&self) -> Option<BlockAlign> {
self.as_any().block_align()
}
pub fn inline_align(&self) -> Option<InlineAlign> {
self.as_any().inline_align()
}
pub fn table_border_style(&self) -> Option<Sides<BorderStyle>> {
self.as_any().table_border_style()
}
pub fn table_padding(&self) -> Option<Sides<f32>> {
self.as_any().table_padding()
}
pub fn baseline_shift(&self) -> Option<f32> {
self.as_any().baseline_shift()
}
pub fn set_baseline_shift(&mut self, baseline_shift: Option<f32>) {
self.as_any_mut().set_baseline_shift(baseline_shift);
}
pub fn with_baseline_shift(mut self, baseline_shift: Option<f32>) -> Self {
self.set_baseline_shift(baseline_shift);
self
}
pub fn line_height(&self) -> Option<LineHeight> {
self.as_any().line_height()
}
pub fn set_line_height(&mut self, line_height: Option<LineHeight>) {
self.as_any_mut().set_line_height(line_height);
}
pub fn with_line_height(mut self, line_height: Option<LineHeight>) -> Self {
self.set_line_height(line_height);
self
}
pub fn text_decoration_color(&self) -> Option<NaiveRgbColor> {
self.as_any().text_decoration_color()
}
pub fn set_text_decoration_color(&mut self, text_decoration_color: Option<NaiveRgbColor>) {
self.as_any_mut().set_text_decoration_color(text_decoration_color);
}
pub fn with_text_decoration_color(mut self, text_decoration_color: Option<NaiveRgbColor>) -> Self {
self.set_text_decoration_color(text_decoration_color);
self
}
pub fn text_decoration_thickness(&self) -> Option<f32> {
self.as_any().text_decoration_thickness()
}
pub fn set_text_decoration_thickness(&mut self, text_decoration_thickness: Option<f32>) {
self.as_any_mut().set_text_decoration_thickness(text_decoration_thickness);
}
pub fn with_text_decoration_thickness(mut self, text_decoration_thickness: Option<f32>) -> Self {
self.set_text_decoration_thickness(text_decoration_thickness);
self
}
pub fn text_decoration_type(&self) -> Option<TextDecorationType> {
self.as_any().text_decoration_type()
}
pub fn set_text_decoration_type(&mut self, text_decoration_type: Option<TextDecorationType>) {
self.as_any_mut().set_text_decoration_type(text_decoration_type);
}
pub fn with_text_decoration_type(mut self, text_decoration_type: Option<TextDecorationType>) -> Self {
self.set_text_decoration_type(text_decoration_type);
self
}
pub fn glyph_orientation_vertical(&self) -> Option<GlyphOrientationVertical> {
self.as_any().glyph_orientation_vertical()
}
pub fn set_glyph_orientation_vertical(&mut self, glyph_orientation_vertical: Option<GlyphOrientationVertical>) {
self.as_any_mut().set_glyph_orientation_vertical(glyph_orientation_vertical);
}
pub fn with_glyph_orientation_vertical(mut self, glyph_orientation_vertical: Option<GlyphOrientationVertical>) -> Self {
self.set_glyph_orientation_vertical(glyph_orientation_vertical);
self
}
pub fn column_count(&self) -> Option<NonZeroU32> {
self.as_any().column_count()
}
pub fn column_gap(&self) -> Option<&ColumnDimensions> {
self.as_any().column_gap()
}
pub fn column_widths(&self) -> Option<&ColumnDimensions> {
self.as_any().column_widths()
}
}
impl AnyTag {
#[inline(always)]
fn get_struct(&self, ordinal: usize) -> Option<&StructAttr> {
self.attrs.get(ordinal).map(Attr::unwrap_struct)
}
#[allow(unused)]
#[inline(always)]
fn set_struct(&mut self, attr: StructAttr) {
self.attrs.set(Attr::Struct(attr));
}
#[allow(unused)]
#[inline(always)]
fn set_or_remove_struct(&mut self, ordinal: usize, attr: Option<StructAttr>) {
self.attrs.set_or_remove(ordinal, attr.map(Attr::Struct));
}
#[inline(always)]
fn get_list(&self, ordinal: usize) -> Option<&ListAttr> {
self.attrs.get(ordinal).map(Attr::unwrap_list)
}
#[allow(unused)]
#[inline(always)]
fn set_list(&mut self, attr: ListAttr) {
self.attrs.set(Attr::List(attr));
}
#[allow(unused)]
#[inline(always)]
fn set_or_remove_list(&mut self, ordinal: usize, attr: Option<ListAttr>) {
self.attrs.set_or_remove(ordinal, attr.map(Attr::List));
}
#[inline(always)]
fn get_table(&self, ordinal: usize) -> Option<&TableAttr> {
self.attrs.get(ordinal).map(Attr::unwrap_table)
}
#[allow(unused)]
#[inline(always)]
fn set_table(&mut self, attr: TableAttr) {
self.attrs.set(Attr::Table(attr));
}
#[allow(unused)]
#[inline(always)]
fn set_or_remove_table(&mut self, ordinal: usize, attr: Option<TableAttr>) {
self.attrs.set_or_remove(ordinal, attr.map(Attr::Table));
}
#[inline(always)]
fn get_layout(&self, ordinal: usize) -> Option<&LayoutAttr> {
self.attrs.get(ordinal).map(Attr::unwrap_layout)
}
#[allow(unused)]
#[inline(always)]
fn set_layout(&mut self, attr: LayoutAttr) {
self.attrs.set(Attr::Layout(attr));
}
#[allow(unused)]
#[inline(always)]
fn set_or_remove_layout(&mut self, ordinal: usize, attr: Option<LayoutAttr>) {
self.attrs.set_or_remove(ordinal, attr.map(Attr::Layout));
}
pub fn id(&self) -> Option<&TagId> {
self.get_struct(StructAttr::ID).map(StructAttr::unwrap_id)
}
pub fn set_id(&mut self, id: Option<TagId>) {
self.set_or_remove_struct(StructAttr::ID, id.map(StructAttr::Id));
}
pub fn with_id(mut self, id: Option<TagId>) -> Self {
self.set_id(id);
self
}
pub fn lang(&self) -> Option<&str> {
self.get_struct(StructAttr::LANG).map(StructAttr::unwrap_lang)
}
pub fn set_lang(&mut self, lang: Option<String>) {
self.set_or_remove_struct(StructAttr::LANG, lang.map(StructAttr::Lang));
}
pub fn with_lang(mut self, lang: Option<String>) -> Self {
self.set_lang(lang);
self
}
pub fn alt_text(&self) -> Option<&str> {
self.get_struct(StructAttr::ALT_TEXT).map(StructAttr::unwrap_alt_text)
}
pub fn set_alt_text(&mut self, alt_text: Option<String>) {
self.set_or_remove_struct(StructAttr::ALT_TEXT, alt_text.map(StructAttr::AltText));
}
pub fn with_alt_text(mut self, alt_text: Option<String>) -> Self {
self.set_alt_text(alt_text);
self
}
pub fn expanded(&self) -> Option<&str> {
self.get_struct(StructAttr::EXPANDED).map(StructAttr::unwrap_expanded)
}
pub fn set_expanded(&mut self, expanded: Option<String>) {
self.set_or_remove_struct(StructAttr::EXPANDED, expanded.map(StructAttr::Expanded));
}
pub fn with_expanded(mut self, expanded: Option<String>) -> Self {
self.set_expanded(expanded);
self
}
pub fn actual_text(&self) -> Option<&str> {
self.get_struct(StructAttr::ACTUAL_TEXT).map(StructAttr::unwrap_actual_text)
}
pub fn set_actual_text(&mut self, actual_text: Option<String>) {
self.set_or_remove_struct(StructAttr::ACTUAL_TEXT, actual_text.map(StructAttr::ActualText));
}
pub fn with_actual_text(mut self, actual_text: Option<String>) -> Self {
self.set_actual_text(actual_text);
self
}
pub fn title(&self) -> Option<&str> {
self.get_struct(StructAttr::TITLE).map(StructAttr::unwrap_title)
}
pub fn level(&self) -> Option<NonZeroU16> {
self.get_struct(StructAttr::HEADING_LEVEL).map(StructAttr::unwrap_level)
}
pub fn numbering(&self) -> Option<ListNumbering> {
self.get_list(ListAttr::NUMBERING).map(ListAttr::unwrap_numbering)
}
pub fn summary(&self) -> Option<&str> {
self.get_table(TableAttr::SUMMARY).map(TableAttr::unwrap_summary)
}
pub fn scope(&self) -> Option<TableHeaderScope> {
self.get_table(TableAttr::HEADER_SCOPE).map(TableAttr::unwrap_scope)
}
pub fn headers(&self) -> Option<&[TagId]> {
self.get_table(TableAttr::CELL_HEADERS).map(TableAttr::unwrap_headers)
}
pub fn row_span(&self) -> Option<NonZeroU32> {
self.get_table(TableAttr::ROW_SPAN).map(TableAttr::unwrap_row_span)
}
pub fn col_span(&self) -> Option<NonZeroU32> {
self.get_table(TableAttr::COL_SPAN).map(TableAttr::unwrap_col_span)
}
pub fn placement(&self) -> Option<Placement> {
self.get_layout(LayoutAttr::PLACEMENT).map(LayoutAttr::unwrap_placement)
}
pub fn set_placement(&mut self, placement: Option<Placement>) {
self.set_or_remove_layout(LayoutAttr::PLACEMENT, placement.map(LayoutAttr::Placement));
}
pub fn with_placement(mut self, placement: Option<Placement>) -> Self {
self.set_placement(placement);
self
}
pub fn writing_mode(&self) -> Option<WritingMode> {
self.get_layout(LayoutAttr::WRITING_MODE).map(LayoutAttr::unwrap_writing_mode)
}
pub fn set_writing_mode(&mut self, writing_mode: Option<WritingMode>) {
self.set_or_remove_layout(LayoutAttr::WRITING_MODE, writing_mode.map(LayoutAttr::WritingMode));
}
pub fn with_writing_mode(mut self, writing_mode: Option<WritingMode>) -> Self {
self.set_writing_mode(writing_mode);
self
}
pub fn bbox(&self) -> Option<BBox> {
self.get_layout(LayoutAttr::B_BOX).map(LayoutAttr::unwrap_bbox)
}
pub fn width(&self) -> Option<f32> {
self.get_layout(LayoutAttr::WIDTH).map(LayoutAttr::unwrap_width)
}
pub fn height(&self) -> Option<f32> {
self.get_layout(LayoutAttr::HEIGHT).map(LayoutAttr::unwrap_height)
}
pub fn background_color(&self) -> Option<NaiveRgbColor> {
self.get_layout(LayoutAttr::BACKGROUND_COLOR).map(LayoutAttr::unwrap_background_color)
}
pub fn set_background_color(&mut self, background_color: Option<NaiveRgbColor>) {
self.set_or_remove_layout(LayoutAttr::BACKGROUND_COLOR, background_color.map(LayoutAttr::BackgroundColor));
}
pub fn with_background_color(mut self, background_color: Option<NaiveRgbColor>) -> Self {
self.set_background_color(background_color);
self
}
pub fn border_color(&self) -> Option<Sides<NaiveRgbColor>> {
self.get_layout(LayoutAttr::BORDER_COLOR).map(LayoutAttr::unwrap_border_color)
}
pub fn set_border_color(&mut self, border_color: Option<Sides<NaiveRgbColor>>) {
self.set_or_remove_layout(LayoutAttr::BORDER_COLOR, border_color.map(LayoutAttr::BorderColor));
}
pub fn with_border_color(mut self, border_color: Option<Sides<NaiveRgbColor>>) -> Self {
self.set_border_color(border_color);
self
}
pub fn border_style(&self) -> Option<Sides<BorderStyle>> {
self.get_layout(LayoutAttr::BORDER_STYLE).map(LayoutAttr::unwrap_border_style)
}
pub fn set_border_style(&mut self, border_style: Option<Sides<BorderStyle>>) {
self.set_or_remove_layout(LayoutAttr::BORDER_STYLE, border_style.map(LayoutAttr::BorderStyle));
}
pub fn with_border_style(mut self, border_style: Option<Sides<BorderStyle>>) -> Self {
self.set_border_style(border_style);
self
}
pub fn border_thickness(&self) -> Option<Sides<f32>> {
self.get_layout(LayoutAttr::BORDER_THICKNESS).map(LayoutAttr::unwrap_border_thickness)
}
pub fn set_border_thickness(&mut self, border_thickness: Option<Sides<f32>>) {
self.set_or_remove_layout(LayoutAttr::BORDER_THICKNESS, border_thickness.map(LayoutAttr::BorderThickness));
}
pub fn with_border_thickness(mut self, border_thickness: Option<Sides<f32>>) -> Self {
self.set_border_thickness(border_thickness);
self
}
pub fn padding(&self) -> Option<Sides<f32>> {
self.get_layout(LayoutAttr::PADDING).map(LayoutAttr::unwrap_padding)
}
pub fn set_padding(&mut self, padding: Option<Sides<f32>>) {
self.set_or_remove_layout(LayoutAttr::PADDING, padding.map(LayoutAttr::Padding));
}
pub fn with_padding(mut self, padding: Option<Sides<f32>>) -> Self {
self.set_padding(padding);
self
}
pub fn color(&self) -> Option<NaiveRgbColor> {
self.get_layout(LayoutAttr::COLOR).map(LayoutAttr::unwrap_color)
}
pub fn set_color(&mut self, color: Option<NaiveRgbColor>) {
self.set_or_remove_layout(LayoutAttr::COLOR, color.map(LayoutAttr::Color));
}
pub fn with_color(mut self, color: Option<NaiveRgbColor>) -> Self {
self.set_color(color);
self
}
pub fn space_before(&self) -> Option<f32> {
self.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn space_after(&self) -> Option<f32> {
self.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn start_indent(&self) -> Option<f32> {
self.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn end_indent(&self) -> Option<f32> {
self.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn text_indent(&self) -> Option<f32> {
self.get_layout(LayoutAttr::TEXT_INDENT).map(LayoutAttr::unwrap_text_indent)
}
pub fn text_align(&self) -> Option<TextAlign> {
self.get_layout(LayoutAttr::TEXT_ALIGN).map(LayoutAttr::unwrap_text_align)
}
pub fn block_align(&self) -> Option<BlockAlign> {
self.get_layout(LayoutAttr::BLOCK_ALIGN).map(LayoutAttr::unwrap_block_align)
}
pub fn inline_align(&self) -> Option<InlineAlign> {
self.get_layout(LayoutAttr::INLINE_ALIGN).map(LayoutAttr::unwrap_inline_align)
}
pub fn table_border_style(&self) -> Option<Sides<BorderStyle>> {
self.get_layout(LayoutAttr::TABLE_BORDER_STYLE).map(LayoutAttr::unwrap_table_border_style)
}
pub fn table_padding(&self) -> Option<Sides<f32>> {
self.get_layout(LayoutAttr::TABLE_PADDING).map(LayoutAttr::unwrap_table_padding)
}
pub fn baseline_shift(&self) -> Option<f32> {
self.get_layout(LayoutAttr::BASELINE_SHIFT).map(LayoutAttr::unwrap_baseline_shift)
}
pub fn set_baseline_shift(&mut self, baseline_shift: Option<f32>) {
self.set_or_remove_layout(LayoutAttr::BASELINE_SHIFT, baseline_shift.map(LayoutAttr::BaselineShift));
}
pub fn with_baseline_shift(mut self, baseline_shift: Option<f32>) -> Self {
self.set_baseline_shift(baseline_shift);
self
}
pub fn line_height(&self) -> Option<LineHeight> {
self.get_layout(LayoutAttr::LINE_HEIGHT).map(LayoutAttr::unwrap_line_height)
}
pub fn set_line_height(&mut self, line_height: Option<LineHeight>) {
self.set_or_remove_layout(LayoutAttr::LINE_HEIGHT, line_height.map(LayoutAttr::LineHeight));
}
pub fn with_line_height(mut self, line_height: Option<LineHeight>) -> Self {
self.set_line_height(line_height);
self
}
pub fn text_decoration_color(&self) -> Option<NaiveRgbColor> {
self.get_layout(LayoutAttr::TEXT_DECORATION_COLOR).map(LayoutAttr::unwrap_text_decoration_color)
}
pub fn set_text_decoration_color(&mut self, text_decoration_color: Option<NaiveRgbColor>) {
self.set_or_remove_layout(LayoutAttr::TEXT_DECORATION_COLOR, text_decoration_color.map(LayoutAttr::TextDecorationColor));
}
pub fn with_text_decoration_color(mut self, text_decoration_color: Option<NaiveRgbColor>) -> Self {
self.set_text_decoration_color(text_decoration_color);
self
}
pub fn text_decoration_thickness(&self) -> Option<f32> {
self.get_layout(LayoutAttr::TEXT_DECORATION_THICKNESS).map(LayoutAttr::unwrap_text_decoration_thickness)
}
pub fn set_text_decoration_thickness(&mut self, text_decoration_thickness: Option<f32>) {
self.set_or_remove_layout(LayoutAttr::TEXT_DECORATION_THICKNESS, text_decoration_thickness.map(LayoutAttr::TextDecorationThickness));
}
pub fn with_text_decoration_thickness(mut self, text_decoration_thickness: Option<f32>) -> Self {
self.set_text_decoration_thickness(text_decoration_thickness);
self
}
pub fn text_decoration_type(&self) -> Option<TextDecorationType> {
self.get_layout(LayoutAttr::TEXT_DECORATION_TYPE).map(LayoutAttr::unwrap_text_decoration_type)
}
pub fn set_text_decoration_type(&mut self, text_decoration_type: Option<TextDecorationType>) {
self.set_or_remove_layout(LayoutAttr::TEXT_DECORATION_TYPE, text_decoration_type.map(LayoutAttr::TextDecorationType));
}
pub fn with_text_decoration_type(mut self, text_decoration_type: Option<TextDecorationType>) -> Self {
self.set_text_decoration_type(text_decoration_type);
self
}
pub fn glyph_orientation_vertical(&self) -> Option<GlyphOrientationVertical> {
self.get_layout(LayoutAttr::GLYPH_ORIENTATION_VERTICAL).map(LayoutAttr::unwrap_glyph_orientation_vertical)
}
pub fn set_glyph_orientation_vertical(&mut self, glyph_orientation_vertical: Option<GlyphOrientationVertical>) {
self.set_or_remove_layout(LayoutAttr::GLYPH_ORIENTATION_VERTICAL, glyph_orientation_vertical.map(LayoutAttr::GlyphOrientationVertical));
}
pub fn with_glyph_orientation_vertical(mut self, glyph_orientation_vertical: Option<GlyphOrientationVertical>) -> Self {
self.set_glyph_orientation_vertical(glyph_orientation_vertical);
self
}
pub fn column_count(&self) -> Option<NonZeroU32> {
self.get_layout(LayoutAttr::COLUMN_COUNT).map(LayoutAttr::unwrap_column_count)
}
pub fn column_gap(&self) -> Option<&ColumnDimensions> {
self.get_layout(LayoutAttr::COLUMN_GAP).map(LayoutAttr::unwrap_column_gap)
}
pub fn column_widths(&self) -> Option<&ColumnDimensions> {
self.get_layout(LayoutAttr::COLUMN_WIDTHS).map(LayoutAttr::unwrap_column_widths)
}
}
impl<T> Tag<T> {
pub fn id(&self) -> Option<&TagId> {
self.inner.get_struct(StructAttr::ID).map(StructAttr::unwrap_id)
}
pub fn set_id(&mut self, id: Option<TagId>) {
self.inner.set_or_remove_struct(StructAttr::ID, id.map(StructAttr::Id));
}
pub fn with_id(mut self, id: Option<TagId>) -> Self {
self.set_id(id);
self
}
pub fn lang(&self) -> Option<&str> {
self.inner.get_struct(StructAttr::LANG).map(StructAttr::unwrap_lang)
}
pub fn set_lang(&mut self, lang: Option<String>) {
self.inner.set_or_remove_struct(StructAttr::LANG, lang.map(StructAttr::Lang));
}
pub fn with_lang(mut self, lang: Option<String>) -> Self {
self.set_lang(lang);
self
}
pub fn alt_text(&self) -> Option<&str> {
self.inner.get_struct(StructAttr::ALT_TEXT).map(StructAttr::unwrap_alt_text)
}
pub fn set_alt_text(&mut self, alt_text: Option<String>) {
self.inner.set_or_remove_struct(StructAttr::ALT_TEXT, alt_text.map(StructAttr::AltText));
}
pub fn with_alt_text(mut self, alt_text: Option<String>) -> Self {
self.set_alt_text(alt_text);
self
}
pub fn expanded(&self) -> Option<&str> {
self.inner.get_struct(StructAttr::EXPANDED).map(StructAttr::unwrap_expanded)
}
pub fn set_expanded(&mut self, expanded: Option<String>) {
self.inner.set_or_remove_struct(StructAttr::EXPANDED, expanded.map(StructAttr::Expanded));
}
pub fn with_expanded(mut self, expanded: Option<String>) -> Self {
self.set_expanded(expanded);
self
}
pub fn actual_text(&self) -> Option<&str> {
self.inner.get_struct(StructAttr::ACTUAL_TEXT).map(StructAttr::unwrap_actual_text)
}
pub fn set_actual_text(&mut self, actual_text: Option<String>) {
self.inner.set_or_remove_struct(StructAttr::ACTUAL_TEXT, actual_text.map(StructAttr::ActualText));
}
pub fn with_actual_text(mut self, actual_text: Option<String>) -> Self {
self.set_actual_text(actual_text);
self
}
pub fn placement(&self) -> Option<Placement> {
self.inner.get_layout(LayoutAttr::PLACEMENT).map(LayoutAttr::unwrap_placement)
}
pub fn set_placement(&mut self, placement: Option<Placement>) {
self.inner.set_or_remove_layout(LayoutAttr::PLACEMENT, placement.map(LayoutAttr::Placement));
}
pub fn with_placement(mut self, placement: Option<Placement>) -> Self {
self.set_placement(placement);
self
}
pub fn writing_mode(&self) -> Option<WritingMode> {
self.inner.get_layout(LayoutAttr::WRITING_MODE).map(LayoutAttr::unwrap_writing_mode)
}
pub fn set_writing_mode(&mut self, writing_mode: Option<WritingMode>) {
self.inner.set_or_remove_layout(LayoutAttr::WRITING_MODE, writing_mode.map(LayoutAttr::WritingMode));
}
pub fn with_writing_mode(mut self, writing_mode: Option<WritingMode>) -> Self {
self.set_writing_mode(writing_mode);
self
}
pub fn background_color(&self) -> Option<NaiveRgbColor> {
self.inner.get_layout(LayoutAttr::BACKGROUND_COLOR).map(LayoutAttr::unwrap_background_color)
}
pub fn set_background_color(&mut self, background_color: Option<NaiveRgbColor>) {
self.inner.set_or_remove_layout(LayoutAttr::BACKGROUND_COLOR, background_color.map(LayoutAttr::BackgroundColor));
}
pub fn with_background_color(mut self, background_color: Option<NaiveRgbColor>) -> Self {
self.set_background_color(background_color);
self
}
pub fn border_color(&self) -> Option<Sides<NaiveRgbColor>> {
self.inner.get_layout(LayoutAttr::BORDER_COLOR).map(LayoutAttr::unwrap_border_color)
}
pub fn set_border_color(&mut self, border_color: Option<Sides<NaiveRgbColor>>) {
self.inner.set_or_remove_layout(LayoutAttr::BORDER_COLOR, border_color.map(LayoutAttr::BorderColor));
}
pub fn with_border_color(mut self, border_color: Option<Sides<NaiveRgbColor>>) -> Self {
self.set_border_color(border_color);
self
}
pub fn border_style(&self) -> Option<Sides<BorderStyle>> {
self.inner.get_layout(LayoutAttr::BORDER_STYLE).map(LayoutAttr::unwrap_border_style)
}
pub fn set_border_style(&mut self, border_style: Option<Sides<BorderStyle>>) {
self.inner.set_or_remove_layout(LayoutAttr::BORDER_STYLE, border_style.map(LayoutAttr::BorderStyle));
}
pub fn with_border_style(mut self, border_style: Option<Sides<BorderStyle>>) -> Self {
self.set_border_style(border_style);
self
}
pub fn border_thickness(&self) -> Option<Sides<f32>> {
self.inner.get_layout(LayoutAttr::BORDER_THICKNESS).map(LayoutAttr::unwrap_border_thickness)
}
pub fn set_border_thickness(&mut self, border_thickness: Option<Sides<f32>>) {
self.inner.set_or_remove_layout(LayoutAttr::BORDER_THICKNESS, border_thickness.map(LayoutAttr::BorderThickness));
}
pub fn with_border_thickness(mut self, border_thickness: Option<Sides<f32>>) -> Self {
self.set_border_thickness(border_thickness);
self
}
pub fn padding(&self) -> Option<Sides<f32>> {
self.inner.get_layout(LayoutAttr::PADDING).map(LayoutAttr::unwrap_padding)
}
pub fn set_padding(&mut self, padding: Option<Sides<f32>>) {
self.inner.set_or_remove_layout(LayoutAttr::PADDING, padding.map(LayoutAttr::Padding));
}
pub fn with_padding(mut self, padding: Option<Sides<f32>>) -> Self {
self.set_padding(padding);
self
}
pub fn color(&self) -> Option<NaiveRgbColor> {
self.inner.get_layout(LayoutAttr::COLOR).map(LayoutAttr::unwrap_color)
}
pub fn set_color(&mut self, color: Option<NaiveRgbColor>) {
self.inner.set_or_remove_layout(LayoutAttr::COLOR, color.map(LayoutAttr::Color));
}
pub fn with_color(mut self, color: Option<NaiveRgbColor>) -> Self {
self.set_color(color);
self
}
pub fn baseline_shift(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::BASELINE_SHIFT).map(LayoutAttr::unwrap_baseline_shift)
}
pub fn set_baseline_shift(&mut self, baseline_shift: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::BASELINE_SHIFT, baseline_shift.map(LayoutAttr::BaselineShift));
}
pub fn with_baseline_shift(mut self, baseline_shift: Option<f32>) -> Self {
self.set_baseline_shift(baseline_shift);
self
}
pub fn line_height(&self) -> Option<LineHeight> {
self.inner.get_layout(LayoutAttr::LINE_HEIGHT).map(LayoutAttr::unwrap_line_height)
}
pub fn set_line_height(&mut self, line_height: Option<LineHeight>) {
self.inner.set_or_remove_layout(LayoutAttr::LINE_HEIGHT, line_height.map(LayoutAttr::LineHeight));
}
pub fn with_line_height(mut self, line_height: Option<LineHeight>) -> Self {
self.set_line_height(line_height);
self
}
pub fn text_decoration_color(&self) -> Option<NaiveRgbColor> {
self.inner.get_layout(LayoutAttr::TEXT_DECORATION_COLOR).map(LayoutAttr::unwrap_text_decoration_color)
}
pub fn set_text_decoration_color(&mut self, text_decoration_color: Option<NaiveRgbColor>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_DECORATION_COLOR, text_decoration_color.map(LayoutAttr::TextDecorationColor));
}
pub fn with_text_decoration_color(mut self, text_decoration_color: Option<NaiveRgbColor>) -> Self {
self.set_text_decoration_color(text_decoration_color);
self
}
pub fn text_decoration_thickness(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::TEXT_DECORATION_THICKNESS).map(LayoutAttr::unwrap_text_decoration_thickness)
}
pub fn set_text_decoration_thickness(&mut self, text_decoration_thickness: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_DECORATION_THICKNESS, text_decoration_thickness.map(LayoutAttr::TextDecorationThickness));
}
pub fn with_text_decoration_thickness(mut self, text_decoration_thickness: Option<f32>) -> Self {
self.set_text_decoration_thickness(text_decoration_thickness);
self
}
pub fn text_decoration_type(&self) -> Option<TextDecorationType> {
self.inner.get_layout(LayoutAttr::TEXT_DECORATION_TYPE).map(LayoutAttr::unwrap_text_decoration_type)
}
pub fn set_text_decoration_type(&mut self, text_decoration_type: Option<TextDecorationType>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_DECORATION_TYPE, text_decoration_type.map(LayoutAttr::TextDecorationType));
}
pub fn with_text_decoration_type(mut self, text_decoration_type: Option<TextDecorationType>) -> Self {
self.set_text_decoration_type(text_decoration_type);
self
}
pub fn glyph_orientation_vertical(&self) -> Option<GlyphOrientationVertical> {
self.inner.get_layout(LayoutAttr::GLYPH_ORIENTATION_VERTICAL).map(LayoutAttr::unwrap_glyph_orientation_vertical)
}
pub fn set_glyph_orientation_vertical(&mut self, glyph_orientation_vertical: Option<GlyphOrientationVertical>) {
self.inner.set_or_remove_layout(LayoutAttr::GLYPH_ORIENTATION_VERTICAL, glyph_orientation_vertical.map(LayoutAttr::GlyphOrientationVertical));
}
pub fn with_glyph_orientation_vertical(mut self, glyph_orientation_vertical: Option<GlyphOrientationVertical>) -> Self {
self.set_glyph_orientation_vertical(glyph_orientation_vertical);
self
}
}
pub mod kind {
#[derive(Clone, Debug, PartialEq)]
pub struct Part;
#[derive(Clone, Debug, PartialEq)]
pub struct Article;
#[derive(Clone, Debug, PartialEq)]
pub struct Section;
#[derive(Clone, Debug, PartialEq)]
pub struct Div;
#[derive(Clone, Debug, PartialEq)]
pub struct BlockQuote;
#[derive(Clone, Debug, PartialEq)]
pub struct Caption;
#[derive(Clone, Debug, PartialEq)]
pub struct TOC;
#[derive(Clone, Debug, PartialEq)]
pub struct TOCI;
#[derive(Clone, Debug, PartialEq)]
pub struct Index;
#[derive(Clone, Debug, PartialEq)]
pub struct P;
#[derive(Clone, Debug, PartialEq)]
pub struct Hn;
#[derive(Clone, Debug, PartialEq)]
pub struct L;
#[derive(Clone, Debug, PartialEq)]
pub struct LI;
#[derive(Clone, Debug, PartialEq)]
pub struct Lbl;
#[derive(Clone, Debug, PartialEq)]
pub struct LBody;
#[derive(Clone, Debug, PartialEq)]
pub struct Table;
#[derive(Clone, Debug, PartialEq)]
pub struct TR;
#[derive(Clone, Debug, PartialEq)]
pub struct TH;
#[derive(Clone, Debug, PartialEq)]
pub struct TD;
#[derive(Clone, Debug, PartialEq)]
pub struct THead;
#[derive(Clone, Debug, PartialEq)]
pub struct TBody;
#[derive(Clone, Debug, PartialEq)]
pub struct TFoot;
#[derive(Clone, Debug, PartialEq)]
pub struct Span;
#[derive(Clone, Debug, PartialEq)]
pub struct InlineQuote;
#[derive(Clone, Debug, PartialEq)]
pub struct Note;
#[derive(Clone, Debug, PartialEq)]
pub struct Reference;
#[derive(Clone, Debug, PartialEq)]
pub struct BibEntry;
#[derive(Clone, Debug, PartialEq)]
pub struct Code;
#[derive(Clone, Debug, PartialEq)]
pub struct Link;
#[derive(Clone, Debug, PartialEq)]
pub struct Annot;
#[derive(Clone, Debug, PartialEq)]
pub struct Figure;
#[derive(Clone, Debug, PartialEq)]
pub struct Formula;
#[derive(Clone, Debug, PartialEq)]
pub struct Form;
#[derive(Clone, Debug, PartialEq)]
pub struct NonStruct;
#[derive(Clone, Debug, PartialEq)]
pub struct Datetime;
#[derive(Clone, Debug, PartialEq)]
pub struct Terms;
#[derive(Clone, Debug, PartialEq)]
pub struct Title;
#[derive(Clone, Debug, PartialEq)]
pub struct Strong;
#[derive(Clone, Debug, PartialEq)]
pub struct Em;
}
impl From<Tag<kind::Part>> for TagKind {
fn from(value: Tag<kind::Part>) -> Self {
Self::Part(value)
}
}
impl Tag<kind::Part> {
#[allow(non_upper_case_globals)]
pub const Part: Tag<kind::Part> = Tag::new();
}
impl From<Tag<kind::Article>> for TagKind {
fn from(value: Tag<kind::Article>) -> Self {
Self::Article(value)
}
}
impl Tag<kind::Article> {
#[allow(non_upper_case_globals)]
pub const Article: Tag<kind::Article> = Tag::new();
pub fn column_count(&self) -> Option<NonZeroU32> {
self.inner.get_layout(LayoutAttr::COLUMN_COUNT).map(LayoutAttr::unwrap_column_count)
}
pub fn set_column_count(&mut self, column_count: Option<NonZeroU32>) {
self.inner.set_or_remove_layout(LayoutAttr::COLUMN_COUNT, column_count.map(LayoutAttr::ColumnCount));
}
pub fn with_column_count(mut self, column_count: Option<NonZeroU32>) -> Self {
self.set_column_count(column_count);
self
}
pub fn column_gap(&self) -> Option<&ColumnDimensions> {
self.inner.get_layout(LayoutAttr::COLUMN_GAP).map(LayoutAttr::unwrap_column_gap)
}
pub fn set_column_gap(&mut self, column_gap: Option<ColumnDimensions>) {
self.inner.set_or_remove_layout(LayoutAttr::COLUMN_GAP, column_gap.map(LayoutAttr::ColumnGap));
}
pub fn with_column_gap(mut self, column_gap: Option<ColumnDimensions>) -> Self {
self.set_column_gap(column_gap);
self
}
pub fn column_widths(&self) -> Option<&ColumnDimensions> {
self.inner.get_layout(LayoutAttr::COLUMN_WIDTHS).map(LayoutAttr::unwrap_column_widths)
}
pub fn set_column_widths(&mut self, column_widths: Option<ColumnDimensions>) {
self.inner.set_or_remove_layout(LayoutAttr::COLUMN_WIDTHS, column_widths.map(LayoutAttr::ColumnWidths));
}
pub fn with_column_widths(mut self, column_widths: Option<ColumnDimensions>) -> Self {
self.set_column_widths(column_widths);
self
}
}
impl From<Tag<kind::Section>> for TagKind {
fn from(value: Tag<kind::Section>) -> Self {
Self::Section(value)
}
}
impl Tag<kind::Section> {
#[allow(non_upper_case_globals)]
pub const Section: Tag<kind::Section> = Tag::new();
pub fn column_count(&self) -> Option<NonZeroU32> {
self.inner.get_layout(LayoutAttr::COLUMN_COUNT).map(LayoutAttr::unwrap_column_count)
}
pub fn set_column_count(&mut self, column_count: Option<NonZeroU32>) {
self.inner.set_or_remove_layout(LayoutAttr::COLUMN_COUNT, column_count.map(LayoutAttr::ColumnCount));
}
pub fn with_column_count(mut self, column_count: Option<NonZeroU32>) -> Self {
self.set_column_count(column_count);
self
}
pub fn column_gap(&self) -> Option<&ColumnDimensions> {
self.inner.get_layout(LayoutAttr::COLUMN_GAP).map(LayoutAttr::unwrap_column_gap)
}
pub fn set_column_gap(&mut self, column_gap: Option<ColumnDimensions>) {
self.inner.set_or_remove_layout(LayoutAttr::COLUMN_GAP, column_gap.map(LayoutAttr::ColumnGap));
}
pub fn with_column_gap(mut self, column_gap: Option<ColumnDimensions>) -> Self {
self.set_column_gap(column_gap);
self
}
pub fn column_widths(&self) -> Option<&ColumnDimensions> {
self.inner.get_layout(LayoutAttr::COLUMN_WIDTHS).map(LayoutAttr::unwrap_column_widths)
}
pub fn set_column_widths(&mut self, column_widths: Option<ColumnDimensions>) {
self.inner.set_or_remove_layout(LayoutAttr::COLUMN_WIDTHS, column_widths.map(LayoutAttr::ColumnWidths));
}
pub fn with_column_widths(mut self, column_widths: Option<ColumnDimensions>) -> Self {
self.set_column_widths(column_widths);
self
}
}
impl From<Tag<kind::Div>> for TagKind {
fn from(value: Tag<kind::Div>) -> Self {
Self::Div(value)
}
}
impl Tag<kind::Div> {
#[allow(non_upper_case_globals)]
pub const Div: Tag<kind::Div> = Tag::new();
pub fn column_count(&self) -> Option<NonZeroU32> {
self.inner.get_layout(LayoutAttr::COLUMN_COUNT).map(LayoutAttr::unwrap_column_count)
}
pub fn set_column_count(&mut self, column_count: Option<NonZeroU32>) {
self.inner.set_or_remove_layout(LayoutAttr::COLUMN_COUNT, column_count.map(LayoutAttr::ColumnCount));
}
pub fn with_column_count(mut self, column_count: Option<NonZeroU32>) -> Self {
self.set_column_count(column_count);
self
}
pub fn column_gap(&self) -> Option<&ColumnDimensions> {
self.inner.get_layout(LayoutAttr::COLUMN_GAP).map(LayoutAttr::unwrap_column_gap)
}
pub fn set_column_gap(&mut self, column_gap: Option<ColumnDimensions>) {
self.inner.set_or_remove_layout(LayoutAttr::COLUMN_GAP, column_gap.map(LayoutAttr::ColumnGap));
}
pub fn with_column_gap(mut self, column_gap: Option<ColumnDimensions>) -> Self {
self.set_column_gap(column_gap);
self
}
pub fn column_widths(&self) -> Option<&ColumnDimensions> {
self.inner.get_layout(LayoutAttr::COLUMN_WIDTHS).map(LayoutAttr::unwrap_column_widths)
}
pub fn set_column_widths(&mut self, column_widths: Option<ColumnDimensions>) {
self.inner.set_or_remove_layout(LayoutAttr::COLUMN_WIDTHS, column_widths.map(LayoutAttr::ColumnWidths));
}
pub fn with_column_widths(mut self, column_widths: Option<ColumnDimensions>) -> Self {
self.set_column_widths(column_widths);
self
}
}
impl From<Tag<kind::BlockQuote>> for TagKind {
fn from(value: Tag<kind::BlockQuote>) -> Self {
Self::BlockQuote(value)
}
}
impl Tag<kind::BlockQuote> {
#[allow(non_upper_case_globals)]
pub const BlockQuote: Tag<kind::BlockQuote> = Tag::new();
}
impl From<Tag<kind::Caption>> for TagKind {
fn from(value: Tag<kind::Caption>) -> Self {
Self::Caption(value)
}
}
impl Tag<kind::Caption> {
#[allow(non_upper_case_globals)]
pub const Caption: Tag<kind::Caption> = Tag::new();
}
impl From<Tag<kind::TOC>> for TagKind {
fn from(value: Tag<kind::TOC>) -> Self {
Self::TOC(value)
}
}
impl Tag<kind::TOC> {
#[allow(non_upper_case_globals)]
pub const TOC: Tag<kind::TOC> = Tag::new();
}
impl From<Tag<kind::TOCI>> for TagKind {
fn from(value: Tag<kind::TOCI>) -> Self {
Self::TOCI(value)
}
}
impl Tag<kind::TOCI> {
#[allow(non_upper_case_globals)]
pub const TOCI: Tag<kind::TOCI> = Tag::new();
}
impl From<Tag<kind::Index>> for TagKind {
fn from(value: Tag<kind::Index>) -> Self {
Self::Index(value)
}
}
impl Tag<kind::Index> {
#[allow(non_upper_case_globals)]
pub const Index: Tag<kind::Index> = Tag::new();
}
impl From<Tag<kind::P>> for TagKind {
fn from(value: Tag<kind::P>) -> Self {
Self::P(value)
}
}
impl Tag<kind::P> {
#[allow(non_upper_case_globals)]
pub const P: Tag<kind::P> = Tag::new();
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
pub fn text_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::TEXT_INDENT).map(LayoutAttr::unwrap_text_indent)
}
pub fn set_text_indent(&mut self, text_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_INDENT, text_indent.map(LayoutAttr::TextIndent));
}
pub fn with_text_indent(mut self, text_indent: Option<f32>) -> Self {
self.set_text_indent(text_indent);
self
}
pub fn text_align(&self) -> Option<TextAlign> {
self.inner.get_layout(LayoutAttr::TEXT_ALIGN).map(LayoutAttr::unwrap_text_align)
}
pub fn set_text_align(&mut self, text_align: Option<TextAlign>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_ALIGN, text_align.map(LayoutAttr::TextAlign));
}
pub fn with_text_align(mut self, text_align: Option<TextAlign>) -> Self {
self.set_text_align(text_align);
self
}
}
impl From<Tag<kind::Hn>> for TagKind {
fn from(value: Tag<kind::Hn>) -> Self {
Self::Hn(value)
}
}
impl Tag<kind::Hn> {
#[allow(non_snake_case)]
pub fn Hn(level: NonZeroU16, title: Option<String>) -> Tag<kind::Hn> {
let mut tag = Tag::new();
tag.set_level(level);
tag.set_title(title);
tag
}
pub fn level(&self) -> NonZeroU16 {
self.inner.get_struct(StructAttr::HEADING_LEVEL).unwrap().unwrap_level()
}
pub fn set_level(&mut self, level: NonZeroU16) {
self.inner.set_struct(StructAttr::HeadingLevel(level));
}
pub fn with_level(mut self, level: NonZeroU16) -> Self {
self.set_level(level);
self
}
pub fn title(&self) -> Option<&str> {
self.inner.get_struct(StructAttr::TITLE).map(StructAttr::unwrap_title)
}
pub fn set_title(&mut self, title: Option<String>) {
self.inner.set_or_remove_struct(StructAttr::TITLE, title.map(StructAttr::Title));
}
pub fn with_title(mut self, title: Option<String>) -> Self {
self.set_title(title);
self
}
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
pub fn text_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::TEXT_INDENT).map(LayoutAttr::unwrap_text_indent)
}
pub fn set_text_indent(&mut self, text_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_INDENT, text_indent.map(LayoutAttr::TextIndent));
}
pub fn with_text_indent(mut self, text_indent: Option<f32>) -> Self {
self.set_text_indent(text_indent);
self
}
pub fn text_align(&self) -> Option<TextAlign> {
self.inner.get_layout(LayoutAttr::TEXT_ALIGN).map(LayoutAttr::unwrap_text_align)
}
pub fn set_text_align(&mut self, text_align: Option<TextAlign>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_ALIGN, text_align.map(LayoutAttr::TextAlign));
}
pub fn with_text_align(mut self, text_align: Option<TextAlign>) -> Self {
self.set_text_align(text_align);
self
}
}
impl From<Tag<kind::L>> for TagKind {
fn from(value: Tag<kind::L>) -> Self {
Self::L(value)
}
}
impl Tag<kind::L> {
#[allow(non_snake_case)]
pub fn L(numbering: ListNumbering) -> Tag<kind::L> {
let mut tag = Tag::new();
tag.set_numbering(numbering);
tag
}
pub fn numbering(&self) -> ListNumbering {
self.inner.get_list(ListAttr::NUMBERING).unwrap().unwrap_numbering()
}
pub fn set_numbering(&mut self, numbering: ListNumbering) {
self.inner.set_list(ListAttr::Numbering(numbering));
}
pub fn with_numbering(mut self, numbering: ListNumbering) -> Self {
self.set_numbering(numbering);
self
}
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
pub fn text_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::TEXT_INDENT).map(LayoutAttr::unwrap_text_indent)
}
pub fn set_text_indent(&mut self, text_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_INDENT, text_indent.map(LayoutAttr::TextIndent));
}
pub fn with_text_indent(mut self, text_indent: Option<f32>) -> Self {
self.set_text_indent(text_indent);
self
}
pub fn text_align(&self) -> Option<TextAlign> {
self.inner.get_layout(LayoutAttr::TEXT_ALIGN).map(LayoutAttr::unwrap_text_align)
}
pub fn set_text_align(&mut self, text_align: Option<TextAlign>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_ALIGN, text_align.map(LayoutAttr::TextAlign));
}
pub fn with_text_align(mut self, text_align: Option<TextAlign>) -> Self {
self.set_text_align(text_align);
self
}
}
impl From<Tag<kind::LI>> for TagKind {
fn from(value: Tag<kind::LI>) -> Self {
Self::LI(value)
}
}
impl Tag<kind::LI> {
#[allow(non_upper_case_globals)]
pub const LI: Tag<kind::LI> = Tag::new();
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
pub fn text_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::TEXT_INDENT).map(LayoutAttr::unwrap_text_indent)
}
pub fn set_text_indent(&mut self, text_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_INDENT, text_indent.map(LayoutAttr::TextIndent));
}
pub fn with_text_indent(mut self, text_indent: Option<f32>) -> Self {
self.set_text_indent(text_indent);
self
}
pub fn text_align(&self) -> Option<TextAlign> {
self.inner.get_layout(LayoutAttr::TEXT_ALIGN).map(LayoutAttr::unwrap_text_align)
}
pub fn set_text_align(&mut self, text_align: Option<TextAlign>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_ALIGN, text_align.map(LayoutAttr::TextAlign));
}
pub fn with_text_align(mut self, text_align: Option<TextAlign>) -> Self {
self.set_text_align(text_align);
self
}
}
impl From<Tag<kind::Lbl>> for TagKind {
fn from(value: Tag<kind::Lbl>) -> Self {
Self::Lbl(value)
}
}
impl Tag<kind::Lbl> {
#[allow(non_upper_case_globals)]
pub const Lbl: Tag<kind::Lbl> = Tag::new();
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
pub fn text_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::TEXT_INDENT).map(LayoutAttr::unwrap_text_indent)
}
pub fn set_text_indent(&mut self, text_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_INDENT, text_indent.map(LayoutAttr::TextIndent));
}
pub fn with_text_indent(mut self, text_indent: Option<f32>) -> Self {
self.set_text_indent(text_indent);
self
}
pub fn text_align(&self) -> Option<TextAlign> {
self.inner.get_layout(LayoutAttr::TEXT_ALIGN).map(LayoutAttr::unwrap_text_align)
}
pub fn set_text_align(&mut self, text_align: Option<TextAlign>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_ALIGN, text_align.map(LayoutAttr::TextAlign));
}
pub fn with_text_align(mut self, text_align: Option<TextAlign>) -> Self {
self.set_text_align(text_align);
self
}
}
impl From<Tag<kind::LBody>> for TagKind {
fn from(value: Tag<kind::LBody>) -> Self {
Self::LBody(value)
}
}
impl Tag<kind::LBody> {
#[allow(non_upper_case_globals)]
pub const LBody: Tag<kind::LBody> = Tag::new();
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
pub fn text_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::TEXT_INDENT).map(LayoutAttr::unwrap_text_indent)
}
pub fn set_text_indent(&mut self, text_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_INDENT, text_indent.map(LayoutAttr::TextIndent));
}
pub fn with_text_indent(mut self, text_indent: Option<f32>) -> Self {
self.set_text_indent(text_indent);
self
}
pub fn text_align(&self) -> Option<TextAlign> {
self.inner.get_layout(LayoutAttr::TEXT_ALIGN).map(LayoutAttr::unwrap_text_align)
}
pub fn set_text_align(&mut self, text_align: Option<TextAlign>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_ALIGN, text_align.map(LayoutAttr::TextAlign));
}
pub fn with_text_align(mut self, text_align: Option<TextAlign>) -> Self {
self.set_text_align(text_align);
self
}
}
impl From<Tag<kind::Table>> for TagKind {
fn from(value: Tag<kind::Table>) -> Self {
Self::Table(value)
}
}
impl Tag<kind::Table> {
#[allow(non_upper_case_globals)]
pub const Table: Tag<kind::Table> = Tag::new();
pub fn summary(&self) -> Option<&str> {
self.inner.get_table(TableAttr::SUMMARY).map(TableAttr::unwrap_summary)
}
pub fn set_summary(&mut self, summary: Option<String>) {
self.inner.set_or_remove_table(TableAttr::SUMMARY, summary.map(TableAttr::Summary));
}
pub fn with_summary(mut self, summary: Option<String>) -> Self {
self.set_summary(summary);
self
}
pub fn bbox(&self) -> Option<BBox> {
self.inner.get_layout(LayoutAttr::B_BOX).map(LayoutAttr::unwrap_bbox)
}
pub fn set_bbox(&mut self, bbox: Option<BBox>) {
self.inner.set_or_remove_layout(LayoutAttr::B_BOX, bbox.map(LayoutAttr::BBox));
}
pub fn with_bbox(mut self, bbox: Option<BBox>) -> Self {
self.set_bbox(bbox);
self
}
pub fn width(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::WIDTH).map(LayoutAttr::unwrap_width)
}
pub fn set_width(&mut self, width: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::WIDTH, width.map(LayoutAttr::Width));
}
pub fn with_width(mut self, width: Option<f32>) -> Self {
self.set_width(width);
self
}
pub fn height(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::HEIGHT).map(LayoutAttr::unwrap_height)
}
pub fn set_height(&mut self, height: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::HEIGHT, height.map(LayoutAttr::Height));
}
pub fn with_height(mut self, height: Option<f32>) -> Self {
self.set_height(height);
self
}
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
pub fn text_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::TEXT_INDENT).map(LayoutAttr::unwrap_text_indent)
}
pub fn set_text_indent(&mut self, text_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_INDENT, text_indent.map(LayoutAttr::TextIndent));
}
pub fn with_text_indent(mut self, text_indent: Option<f32>) -> Self {
self.set_text_indent(text_indent);
self
}
pub fn text_align(&self) -> Option<TextAlign> {
self.inner.get_layout(LayoutAttr::TEXT_ALIGN).map(LayoutAttr::unwrap_text_align)
}
pub fn set_text_align(&mut self, text_align: Option<TextAlign>) {
self.inner.set_or_remove_layout(LayoutAttr::TEXT_ALIGN, text_align.map(LayoutAttr::TextAlign));
}
pub fn with_text_align(mut self, text_align: Option<TextAlign>) -> Self {
self.set_text_align(text_align);
self
}
}
impl From<Tag<kind::TR>> for TagKind {
fn from(value: Tag<kind::TR>) -> Self {
Self::TR(value)
}
}
impl Tag<kind::TR> {
#[allow(non_upper_case_globals)]
pub const TR: Tag<kind::TR> = Tag::new();
}
impl From<Tag<kind::TH>> for TagKind {
fn from(value: Tag<kind::TH>) -> Self {
Self::TH(value)
}
}
impl Tag<kind::TH> {
#[allow(non_snake_case)]
pub fn TH(scope: TableHeaderScope) -> Tag<kind::TH> {
let mut tag = Tag::new();
tag.set_scope(scope);
tag
}
pub fn scope(&self) -> TableHeaderScope {
self.inner.get_table(TableAttr::HEADER_SCOPE).unwrap().unwrap_scope()
}
pub fn set_scope(&mut self, scope: TableHeaderScope) {
self.inner.set_table(TableAttr::HeaderScope(scope));
}
pub fn with_scope(mut self, scope: TableHeaderScope) -> Self {
self.set_scope(scope);
self
}
pub fn headers(&self) -> Option<&[TagId]> {
self.inner.get_table(TableAttr::CELL_HEADERS).map(TableAttr::unwrap_headers)
}
pub fn set_headers(&mut self, headers: Option<impl IntoIterator<Item = TagId>>) {
self.inner.set_or_remove_table(TableAttr::CELL_HEADERS, headers.map(|ids| ids.into_iter().collect()).map(TableAttr::CellHeaders));
}
pub fn with_headers(mut self, headers: Option<impl IntoIterator<Item = TagId>>) -> Self {
self.set_headers(headers);
self
}
pub fn row_span(&self) -> Option<NonZeroU32> {
self.inner.get_table(TableAttr::ROW_SPAN).map(TableAttr::unwrap_row_span)
}
pub fn set_row_span(&mut self, row_span: Option<NonZeroU32>) {
self.inner.set_or_remove_table(TableAttr::ROW_SPAN, row_span.map(TableAttr::RowSpan));
}
pub fn with_row_span(mut self, row_span: Option<NonZeroU32>) -> Self {
self.set_row_span(row_span);
self
}
pub fn col_span(&self) -> Option<NonZeroU32> {
self.inner.get_table(TableAttr::COL_SPAN).map(TableAttr::unwrap_col_span)
}
pub fn set_col_span(&mut self, col_span: Option<NonZeroU32>) {
self.inner.set_or_remove_table(TableAttr::COL_SPAN, col_span.map(TableAttr::ColSpan));
}
pub fn with_col_span(mut self, col_span: Option<NonZeroU32>) -> Self {
self.set_col_span(col_span);
self
}
pub fn width(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::WIDTH).map(LayoutAttr::unwrap_width)
}
pub fn set_width(&mut self, width: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::WIDTH, width.map(LayoutAttr::Width));
}
pub fn with_width(mut self, width: Option<f32>) -> Self {
self.set_width(width);
self
}
pub fn height(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::HEIGHT).map(LayoutAttr::unwrap_height)
}
pub fn set_height(&mut self, height: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::HEIGHT, height.map(LayoutAttr::Height));
}
pub fn with_height(mut self, height: Option<f32>) -> Self {
self.set_height(height);
self
}
pub fn table_border_style(&self) -> Option<Sides<BorderStyle>> {
self.inner.get_layout(LayoutAttr::TABLE_BORDER_STYLE).map(LayoutAttr::unwrap_table_border_style)
}
pub fn set_table_border_style(&mut self, table_border_style: Option<Sides<BorderStyle>>) {
self.inner.set_or_remove_layout(LayoutAttr::TABLE_BORDER_STYLE, table_border_style.map(LayoutAttr::TableBorderStyle));
}
pub fn with_table_border_style(mut self, table_border_style: Option<Sides<BorderStyle>>) -> Self {
self.set_table_border_style(table_border_style);
self
}
pub fn table_padding(&self) -> Option<Sides<f32>> {
self.inner.get_layout(LayoutAttr::TABLE_PADDING).map(LayoutAttr::unwrap_table_padding)
}
pub fn set_table_padding(&mut self, table_padding: Option<Sides<f32>>) {
self.inner.set_or_remove_layout(LayoutAttr::TABLE_PADDING, table_padding.map(LayoutAttr::TablePadding));
}
pub fn with_table_padding(mut self, table_padding: Option<Sides<f32>>) -> Self {
self.set_table_padding(table_padding);
self
}
pub fn block_align(&self) -> Option<BlockAlign> {
self.inner.get_layout(LayoutAttr::BLOCK_ALIGN).map(LayoutAttr::unwrap_block_align)
}
pub fn set_block_align(&mut self, block_align: Option<BlockAlign>) {
self.inner.set_or_remove_layout(LayoutAttr::BLOCK_ALIGN, block_align.map(LayoutAttr::BlockAlign));
}
pub fn with_block_align(mut self, block_align: Option<BlockAlign>) -> Self {
self.set_block_align(block_align);
self
}
pub fn inline_align(&self) -> Option<InlineAlign> {
self.inner.get_layout(LayoutAttr::INLINE_ALIGN).map(LayoutAttr::unwrap_inline_align)
}
pub fn set_inline_align(&mut self, inline_align: Option<InlineAlign>) {
self.inner.set_or_remove_layout(LayoutAttr::INLINE_ALIGN, inline_align.map(LayoutAttr::InlineAlign));
}
pub fn with_inline_align(mut self, inline_align: Option<InlineAlign>) -> Self {
self.set_inline_align(inline_align);
self
}
}
impl From<Tag<kind::TD>> for TagKind {
fn from(value: Tag<kind::TD>) -> Self {
Self::TD(value)
}
}
impl Tag<kind::TD> {
#[allow(non_upper_case_globals)]
pub const TD: Tag<kind::TD> = Tag::new();
pub fn headers(&self) -> Option<&[TagId]> {
self.inner.get_table(TableAttr::CELL_HEADERS).map(TableAttr::unwrap_headers)
}
pub fn set_headers(&mut self, headers: Option<impl IntoIterator<Item = TagId>>) {
self.inner.set_or_remove_table(TableAttr::CELL_HEADERS, headers.map(|ids| ids.into_iter().collect()).map(TableAttr::CellHeaders));
}
pub fn with_headers(mut self, headers: Option<impl IntoIterator<Item = TagId>>) -> Self {
self.set_headers(headers);
self
}
pub fn row_span(&self) -> Option<NonZeroU32> {
self.inner.get_table(TableAttr::ROW_SPAN).map(TableAttr::unwrap_row_span)
}
pub fn set_row_span(&mut self, row_span: Option<NonZeroU32>) {
self.inner.set_or_remove_table(TableAttr::ROW_SPAN, row_span.map(TableAttr::RowSpan));
}
pub fn with_row_span(mut self, row_span: Option<NonZeroU32>) -> Self {
self.set_row_span(row_span);
self
}
pub fn col_span(&self) -> Option<NonZeroU32> {
self.inner.get_table(TableAttr::COL_SPAN).map(TableAttr::unwrap_col_span)
}
pub fn set_col_span(&mut self, col_span: Option<NonZeroU32>) {
self.inner.set_or_remove_table(TableAttr::COL_SPAN, col_span.map(TableAttr::ColSpan));
}
pub fn with_col_span(mut self, col_span: Option<NonZeroU32>) -> Self {
self.set_col_span(col_span);
self
}
pub fn width(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::WIDTH).map(LayoutAttr::unwrap_width)
}
pub fn set_width(&mut self, width: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::WIDTH, width.map(LayoutAttr::Width));
}
pub fn with_width(mut self, width: Option<f32>) -> Self {
self.set_width(width);
self
}
pub fn height(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::HEIGHT).map(LayoutAttr::unwrap_height)
}
pub fn set_height(&mut self, height: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::HEIGHT, height.map(LayoutAttr::Height));
}
pub fn with_height(mut self, height: Option<f32>) -> Self {
self.set_height(height);
self
}
pub fn table_border_style(&self) -> Option<Sides<BorderStyle>> {
self.inner.get_layout(LayoutAttr::TABLE_BORDER_STYLE).map(LayoutAttr::unwrap_table_border_style)
}
pub fn set_table_border_style(&mut self, table_border_style: Option<Sides<BorderStyle>>) {
self.inner.set_or_remove_layout(LayoutAttr::TABLE_BORDER_STYLE, table_border_style.map(LayoutAttr::TableBorderStyle));
}
pub fn with_table_border_style(mut self, table_border_style: Option<Sides<BorderStyle>>) -> Self {
self.set_table_border_style(table_border_style);
self
}
pub fn table_padding(&self) -> Option<Sides<f32>> {
self.inner.get_layout(LayoutAttr::TABLE_PADDING).map(LayoutAttr::unwrap_table_padding)
}
pub fn set_table_padding(&mut self, table_padding: Option<Sides<f32>>) {
self.inner.set_or_remove_layout(LayoutAttr::TABLE_PADDING, table_padding.map(LayoutAttr::TablePadding));
}
pub fn with_table_padding(mut self, table_padding: Option<Sides<f32>>) -> Self {
self.set_table_padding(table_padding);
self
}
pub fn block_align(&self) -> Option<BlockAlign> {
self.inner.get_layout(LayoutAttr::BLOCK_ALIGN).map(LayoutAttr::unwrap_block_align)
}
pub fn set_block_align(&mut self, block_align: Option<BlockAlign>) {
self.inner.set_or_remove_layout(LayoutAttr::BLOCK_ALIGN, block_align.map(LayoutAttr::BlockAlign));
}
pub fn with_block_align(mut self, block_align: Option<BlockAlign>) -> Self {
self.set_block_align(block_align);
self
}
pub fn inline_align(&self) -> Option<InlineAlign> {
self.inner.get_layout(LayoutAttr::INLINE_ALIGN).map(LayoutAttr::unwrap_inline_align)
}
pub fn set_inline_align(&mut self, inline_align: Option<InlineAlign>) {
self.inner.set_or_remove_layout(LayoutAttr::INLINE_ALIGN, inline_align.map(LayoutAttr::InlineAlign));
}
pub fn with_inline_align(mut self, inline_align: Option<InlineAlign>) -> Self {
self.set_inline_align(inline_align);
self
}
}
impl From<Tag<kind::THead>> for TagKind {
fn from(value: Tag<kind::THead>) -> Self {
Self::THead(value)
}
}
impl Tag<kind::THead> {
#[allow(non_upper_case_globals)]
pub const THead: Tag<kind::THead> = Tag::new();
}
impl From<Tag<kind::TBody>> for TagKind {
fn from(value: Tag<kind::TBody>) -> Self {
Self::TBody(value)
}
}
impl Tag<kind::TBody> {
#[allow(non_upper_case_globals)]
pub const TBody: Tag<kind::TBody> = Tag::new();
}
impl From<Tag<kind::TFoot>> for TagKind {
fn from(value: Tag<kind::TFoot>) -> Self {
Self::TFoot(value)
}
}
impl Tag<kind::TFoot> {
#[allow(non_upper_case_globals)]
pub const TFoot: Tag<kind::TFoot> = Tag::new();
}
impl From<Tag<kind::Span>> for TagKind {
fn from(value: Tag<kind::Span>) -> Self {
Self::Span(value)
}
}
impl Tag<kind::Span> {
#[allow(non_upper_case_globals)]
pub const Span: Tag<kind::Span> = Tag::new();
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
}
impl From<Tag<kind::InlineQuote>> for TagKind {
fn from(value: Tag<kind::InlineQuote>) -> Self {
Self::InlineQuote(value)
}
}
impl Tag<kind::InlineQuote> {
#[allow(non_upper_case_globals)]
pub const InlineQuote: Tag<kind::InlineQuote> = Tag::new();
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
}
impl From<Tag<kind::Note>> for TagKind {
fn from(value: Tag<kind::Note>) -> Self {
Self::Note(value)
}
}
impl Tag<kind::Note> {
#[allow(non_upper_case_globals)]
pub const Note: Tag<kind::Note> = Tag::new();
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
}
impl From<Tag<kind::Reference>> for TagKind {
fn from(value: Tag<kind::Reference>) -> Self {
Self::Reference(value)
}
}
impl Tag<kind::Reference> {
#[allow(non_upper_case_globals)]
pub const Reference: Tag<kind::Reference> = Tag::new();
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
}
impl From<Tag<kind::BibEntry>> for TagKind {
fn from(value: Tag<kind::BibEntry>) -> Self {
Self::BibEntry(value)
}
}
impl Tag<kind::BibEntry> {
#[allow(non_upper_case_globals)]
pub const BibEntry: Tag<kind::BibEntry> = Tag::new();
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
}
impl From<Tag<kind::Code>> for TagKind {
fn from(value: Tag<kind::Code>) -> Self {
Self::Code(value)
}
}
impl Tag<kind::Code> {
#[allow(non_upper_case_globals)]
pub const Code: Tag<kind::Code> = Tag::new();
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
}
impl From<Tag<kind::Link>> for TagKind {
fn from(value: Tag<kind::Link>) -> Self {
Self::Link(value)
}
}
impl Tag<kind::Link> {
#[allow(non_upper_case_globals)]
pub const Link: Tag<kind::Link> = Tag::new();
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
}
impl From<Tag<kind::Annot>> for TagKind {
fn from(value: Tag<kind::Annot>) -> Self {
Self::Annot(value)
}
}
impl Tag<kind::Annot> {
#[allow(non_upper_case_globals)]
pub const Annot: Tag<kind::Annot> = Tag::new();
pub fn space_before(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_BEFORE).map(LayoutAttr::unwrap_space_before)
}
pub fn set_space_before(&mut self, space_before: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_BEFORE, space_before.map(LayoutAttr::SpaceBefore));
}
pub fn with_space_before(mut self, space_before: Option<f32>) -> Self {
self.set_space_before(space_before);
self
}
pub fn space_after(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::SPACE_AFTER).map(LayoutAttr::unwrap_space_after)
}
pub fn set_space_after(&mut self, space_after: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::SPACE_AFTER, space_after.map(LayoutAttr::SpaceAfter));
}
pub fn with_space_after(mut self, space_after: Option<f32>) -> Self {
self.set_space_after(space_after);
self
}
pub fn start_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::START_INDENT).map(LayoutAttr::unwrap_start_indent)
}
pub fn set_start_indent(&mut self, start_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::START_INDENT, start_indent.map(LayoutAttr::StartIndent));
}
pub fn with_start_indent(mut self, start_indent: Option<f32>) -> Self {
self.set_start_indent(start_indent);
self
}
pub fn end_indent(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::END_INDENT).map(LayoutAttr::unwrap_end_indent)
}
pub fn set_end_indent(&mut self, end_indent: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::END_INDENT, end_indent.map(LayoutAttr::EndIndent));
}
pub fn with_end_indent(mut self, end_indent: Option<f32>) -> Self {
self.set_end_indent(end_indent);
self
}
}
impl From<Tag<kind::Figure>> for TagKind {
fn from(value: Tag<kind::Figure>) -> Self {
Self::Figure(value)
}
}
impl Tag<kind::Figure> {
#[allow(non_snake_case)]
pub fn Figure(alt_text: Option<String>) -> Tag<kind::Figure> {
let mut tag = Tag::new();
tag.set_alt_text(alt_text);
tag
}
pub fn bbox(&self) -> Option<BBox> {
self.inner.get_layout(LayoutAttr::B_BOX).map(LayoutAttr::unwrap_bbox)
}
pub fn set_bbox(&mut self, bbox: Option<BBox>) {
self.inner.set_or_remove_layout(LayoutAttr::B_BOX, bbox.map(LayoutAttr::BBox));
}
pub fn with_bbox(mut self, bbox: Option<BBox>) -> Self {
self.set_bbox(bbox);
self
}
pub fn width(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::WIDTH).map(LayoutAttr::unwrap_width)
}
pub fn set_width(&mut self, width: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::WIDTH, width.map(LayoutAttr::Width));
}
pub fn with_width(mut self, width: Option<f32>) -> Self {
self.set_width(width);
self
}
pub fn height(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::HEIGHT).map(LayoutAttr::unwrap_height)
}
pub fn set_height(&mut self, height: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::HEIGHT, height.map(LayoutAttr::Height));
}
pub fn with_height(mut self, height: Option<f32>) -> Self {
self.set_height(height);
self
}
}
impl From<Tag<kind::Formula>> for TagKind {
fn from(value: Tag<kind::Formula>) -> Self {
Self::Formula(value)
}
}
impl Tag<kind::Formula> {
#[allow(non_snake_case)]
pub fn Formula(alt_text: Option<String>) -> Tag<kind::Formula> {
let mut tag = Tag::new();
tag.set_alt_text(alt_text);
tag
}
pub fn bbox(&self) -> Option<BBox> {
self.inner.get_layout(LayoutAttr::B_BOX).map(LayoutAttr::unwrap_bbox)
}
pub fn set_bbox(&mut self, bbox: Option<BBox>) {
self.inner.set_or_remove_layout(LayoutAttr::B_BOX, bbox.map(LayoutAttr::BBox));
}
pub fn with_bbox(mut self, bbox: Option<BBox>) -> Self {
self.set_bbox(bbox);
self
}
pub fn width(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::WIDTH).map(LayoutAttr::unwrap_width)
}
pub fn set_width(&mut self, width: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::WIDTH, width.map(LayoutAttr::Width));
}
pub fn with_width(mut self, width: Option<f32>) -> Self {
self.set_width(width);
self
}
pub fn height(&self) -> Option<f32> {
self.inner.get_layout(LayoutAttr::HEIGHT).map(LayoutAttr::unwrap_height)
}
pub fn set_height(&mut self, height: Option<f32>) {
self.inner.set_or_remove_layout(LayoutAttr::HEIGHT, height.map(LayoutAttr::Height));
}
pub fn with_height(mut self, height: Option<f32>) -> Self {
self.set_height(height);
self
}
}
impl From<Tag<kind::Form>> for TagKind {
fn from(value: Tag<kind::Form>) -> Self {
Self::Form(value)
}
}
impl Tag<kind::Form> {
#[allow(non_upper_case_globals)]
pub const Form: Tag<kind::Form> = Tag::new();
}
impl From<Tag<kind::NonStruct>> for TagKind {
fn from(value: Tag<kind::NonStruct>) -> Self {
Self::NonStruct(value)
}
}
impl Tag<kind::NonStruct> {
#[allow(non_upper_case_globals)]
pub const NonStruct: Tag<kind::NonStruct> = Tag::new();
}
impl From<Tag<kind::Datetime>> for TagKind {
fn from(value: Tag<kind::Datetime>) -> Self {
Self::Datetime(value)
}
}
impl Tag<kind::Datetime> {
#[allow(non_upper_case_globals)]
pub const Datetime: Tag<kind::Datetime> = Tag::new();
}
impl From<Tag<kind::Terms>> for TagKind {
fn from(value: Tag<kind::Terms>) -> Self {
Self::Terms(value)
}
}
impl Tag<kind::Terms> {
#[allow(non_upper_case_globals)]
pub const Terms: Tag<kind::Terms> = Tag::new();
}
impl From<Tag<kind::Title>> for TagKind {
fn from(value: Tag<kind::Title>) -> Self {
Self::Title(value)
}
}
impl Tag<kind::Title> {
#[allow(non_upper_case_globals)]
pub const Title: Tag<kind::Title> = Tag::new();
}
impl From<Tag<kind::Strong>> for TagKind {
fn from(value: Tag<kind::Strong>) -> Self {
Self::Strong(value)
}
}
impl Tag<kind::Strong> {
#[allow(non_upper_case_globals)]
pub const Strong: Tag<kind::Strong> = Tag::new();
}
impl From<Tag<kind::Em>> for TagKind {
fn from(value: Tag<kind::Em>) -> Self {
Self::Em(value)
}
}
impl Tag<kind::Em> {
#[allow(non_upper_case_globals)]
pub const Em: Tag<kind::Em> = Tag::new();
}
#[derive(Clone, Debug, PartialEq)]
pub(crate) enum Attr {
Struct(StructAttr),
List(ListAttr),
Table(TableAttr),
Layout(LayoutAttr),
}
impl Attr {
#[inline(always)]
fn unwrap_struct(&self) -> &StructAttr {
match self {
Self::Struct(attr) => attr,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_list(&self) -> &ListAttr {
match self {
Self::List(attr) => attr,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_table(&self) -> &TableAttr {
match self {
Self::Table(attr) => attr,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_layout(&self) -> &LayoutAttr {
match self {
Self::Layout(attr) => attr,
_ => unreachable!(),
}
}
}
impl Ordinal for Attr {
fn ordinal(&self) -> usize {
match self {
Self::Struct(a) => a.ordinal(),
Self::List(a) => a.ordinal(),
Self::Table(a) => a.ordinal(),
Self::Layout(a) => a.ordinal(),
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub(crate) enum StructAttr {
Id(TagId),
Lang(String),
AltText(String),
Expanded(String),
ActualText(String),
Title(String),
HeadingLevel(NonZeroU16),
}
impl StructAttr {
pub(crate) const ID: usize = 0;
pub(crate) const LANG: usize = 1;
pub(crate) const ALT_TEXT: usize = 2;
pub(crate) const EXPANDED: usize = 3;
pub(crate) const ACTUAL_TEXT: usize = 4;
pub(crate) const TITLE: usize = 5;
pub(crate) const HEADING_LEVEL: usize = 6;
#[inline(always)]
fn unwrap_id(&self) -> &TagId {
match self {
Self::Id(val) => val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_lang(&self) -> &str {
match self {
Self::Lang(val) => val.as_ref(),
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_alt_text(&self) -> &str {
match self {
Self::AltText(val) => val.as_ref(),
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_expanded(&self) -> &str {
match self {
Self::Expanded(val) => val.as_ref(),
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_actual_text(&self) -> &str {
match self {
Self::ActualText(val) => val.as_ref(),
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_title(&self) -> &str {
match self {
Self::Title(val) => val.as_ref(),
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_level(&self) -> NonZeroU16 {
match self {
Self::HeadingLevel(val) => *val,
_ => unreachable!(),
}
}
}
impl Ordinal for StructAttr {
fn ordinal(&self) -> usize {
match self {
Self::Id(_) => Self::ID,
Self::Lang(_) => Self::LANG,
Self::AltText(_) => Self::ALT_TEXT,
Self::Expanded(_) => Self::EXPANDED,
Self::ActualText(_) => Self::ACTUAL_TEXT,
Self::Title(_) => Self::TITLE,
Self::HeadingLevel(_) => Self::HEADING_LEVEL,
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub(crate) enum ListAttr {
Numbering(ListNumbering),
}
impl ListAttr {
pub(crate) const NUMBERING: usize = 7;
#[inline(always)]
fn unwrap_numbering(&self) -> ListNumbering {
match self {
Self::Numbering(val) => *val,
}
}
}
impl Ordinal for ListAttr {
fn ordinal(&self) -> usize {
match self {
Self::Numbering(_) => Self::NUMBERING,
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub(crate) enum TableAttr {
Summary(String),
HeaderScope(TableHeaderScope),
CellHeaders(SmallVec<[TagId; 1]>),
RowSpan(NonZeroU32),
ColSpan(NonZeroU32),
}
impl TableAttr {
pub(crate) const SUMMARY: usize = 8;
pub(crate) const HEADER_SCOPE: usize = 9;
pub(crate) const CELL_HEADERS: usize = 10;
pub(crate) const ROW_SPAN: usize = 11;
pub(crate) const COL_SPAN: usize = 12;
#[inline(always)]
fn unwrap_summary(&self) -> &str {
match self {
Self::Summary(val) => val.as_ref(),
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_scope(&self) -> TableHeaderScope {
match self {
Self::HeaderScope(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_headers(&self) -> &[TagId] {
match self {
Self::CellHeaders(val) => val.as_ref(),
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_row_span(&self) -> NonZeroU32 {
match self {
Self::RowSpan(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_col_span(&self) -> NonZeroU32 {
match self {
Self::ColSpan(val) => *val,
_ => unreachable!(),
}
}
}
impl Ordinal for TableAttr {
fn ordinal(&self) -> usize {
match self {
Self::Summary(_) => Self::SUMMARY,
Self::HeaderScope(_) => Self::HEADER_SCOPE,
Self::CellHeaders(_) => Self::CELL_HEADERS,
Self::RowSpan(_) => Self::ROW_SPAN,
Self::ColSpan(_) => Self::COL_SPAN,
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub(crate) enum LayoutAttr {
Placement(Placement),
WritingMode(WritingMode),
BBox(BBox),
Width(f32),
Height(f32),
BackgroundColor(NaiveRgbColor),
BorderColor(Sides<NaiveRgbColor>),
BorderStyle(Sides<BorderStyle>),
BorderThickness(Sides<f32>),
Padding(Sides<f32>),
Color(NaiveRgbColor),
SpaceBefore(f32),
SpaceAfter(f32),
StartIndent(f32),
EndIndent(f32),
TextIndent(f32),
TextAlign(TextAlign),
BlockAlign(BlockAlign),
InlineAlign(InlineAlign),
TableBorderStyle(Sides<BorderStyle>),
TablePadding(Sides<f32>),
BaselineShift(f32),
LineHeight(LineHeight),
TextDecorationColor(NaiveRgbColor),
TextDecorationThickness(f32),
TextDecorationType(TextDecorationType),
GlyphOrientationVertical(GlyphOrientationVertical),
ColumnCount(NonZeroU32),
ColumnGap(ColumnDimensions),
ColumnWidths(ColumnDimensions),
}
impl LayoutAttr {
pub(crate) const PLACEMENT: usize = 13;
pub(crate) const WRITING_MODE: usize = 14;
pub(crate) const B_BOX: usize = 15;
pub(crate) const WIDTH: usize = 16;
pub(crate) const HEIGHT: usize = 17;
pub(crate) const BACKGROUND_COLOR: usize = 18;
pub(crate) const BORDER_COLOR: usize = 19;
pub(crate) const BORDER_STYLE: usize = 20;
pub(crate) const BORDER_THICKNESS: usize = 21;
pub(crate) const PADDING: usize = 22;
pub(crate) const COLOR: usize = 23;
pub(crate) const SPACE_BEFORE: usize = 24;
pub(crate) const SPACE_AFTER: usize = 25;
pub(crate) const START_INDENT: usize = 26;
pub(crate) const END_INDENT: usize = 27;
pub(crate) const TEXT_INDENT: usize = 28;
pub(crate) const TEXT_ALIGN: usize = 29;
pub(crate) const BLOCK_ALIGN: usize = 30;
pub(crate) const INLINE_ALIGN: usize = 31;
pub(crate) const TABLE_BORDER_STYLE: usize = 32;
pub(crate) const TABLE_PADDING: usize = 33;
pub(crate) const BASELINE_SHIFT: usize = 34;
pub(crate) const LINE_HEIGHT: usize = 35;
pub(crate) const TEXT_DECORATION_COLOR: usize = 36;
pub(crate) const TEXT_DECORATION_THICKNESS: usize = 37;
pub(crate) const TEXT_DECORATION_TYPE: usize = 38;
pub(crate) const GLYPH_ORIENTATION_VERTICAL: usize = 39;
pub(crate) const COLUMN_COUNT: usize = 40;
pub(crate) const COLUMN_GAP: usize = 41;
pub(crate) const COLUMN_WIDTHS: usize = 42;
#[inline(always)]
fn unwrap_placement(&self) -> Placement {
match self {
Self::Placement(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_writing_mode(&self) -> WritingMode {
match self {
Self::WritingMode(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_bbox(&self) -> BBox {
match self {
Self::BBox(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_width(&self) -> f32 {
match self {
Self::Width(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_height(&self) -> f32 {
match self {
Self::Height(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_background_color(&self) -> NaiveRgbColor {
match self {
Self::BackgroundColor(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_border_color(&self) -> Sides<NaiveRgbColor> {
match self {
Self::BorderColor(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_border_style(&self) -> Sides<BorderStyle> {
match self {
Self::BorderStyle(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_border_thickness(&self) -> Sides<f32> {
match self {
Self::BorderThickness(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_padding(&self) -> Sides<f32> {
match self {
Self::Padding(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_color(&self) -> NaiveRgbColor {
match self {
Self::Color(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_space_before(&self) -> f32 {
match self {
Self::SpaceBefore(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_space_after(&self) -> f32 {
match self {
Self::SpaceAfter(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_start_indent(&self) -> f32 {
match self {
Self::StartIndent(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_end_indent(&self) -> f32 {
match self {
Self::EndIndent(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_text_indent(&self) -> f32 {
match self {
Self::TextIndent(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_text_align(&self) -> TextAlign {
match self {
Self::TextAlign(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_block_align(&self) -> BlockAlign {
match self {
Self::BlockAlign(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_inline_align(&self) -> InlineAlign {
match self {
Self::InlineAlign(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_table_border_style(&self) -> Sides<BorderStyle> {
match self {
Self::TableBorderStyle(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_table_padding(&self) -> Sides<f32> {
match self {
Self::TablePadding(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_baseline_shift(&self) -> f32 {
match self {
Self::BaselineShift(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_line_height(&self) -> LineHeight {
match self {
Self::LineHeight(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_text_decoration_color(&self) -> NaiveRgbColor {
match self {
Self::TextDecorationColor(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_text_decoration_thickness(&self) -> f32 {
match self {
Self::TextDecorationThickness(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_text_decoration_type(&self) -> TextDecorationType {
match self {
Self::TextDecorationType(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_glyph_orientation_vertical(&self) -> GlyphOrientationVertical {
match self {
Self::GlyphOrientationVertical(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_column_count(&self) -> NonZeroU32 {
match self {
Self::ColumnCount(val) => *val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_column_gap(&self) -> &ColumnDimensions {
match self {
Self::ColumnGap(val) => val,
_ => unreachable!(),
}
}
#[inline(always)]
fn unwrap_column_widths(&self) -> &ColumnDimensions {
match self {
Self::ColumnWidths(val) => val,
_ => unreachable!(),
}
}
}
impl Ordinal for LayoutAttr {
fn ordinal(&self) -> usize {
match self {
Self::Placement(_) => Self::PLACEMENT,
Self::WritingMode(_) => Self::WRITING_MODE,
Self::BBox(_) => Self::B_BOX,
Self::Width(_) => Self::WIDTH,
Self::Height(_) => Self::HEIGHT,
Self::BackgroundColor(_) => Self::BACKGROUND_COLOR,
Self::BorderColor(_) => Self::BORDER_COLOR,
Self::BorderStyle(_) => Self::BORDER_STYLE,
Self::BorderThickness(_) => Self::BORDER_THICKNESS,
Self::Padding(_) => Self::PADDING,
Self::Color(_) => Self::COLOR,
Self::SpaceBefore(_) => Self::SPACE_BEFORE,
Self::SpaceAfter(_) => Self::SPACE_AFTER,
Self::StartIndent(_) => Self::START_INDENT,
Self::EndIndent(_) => Self::END_INDENT,
Self::TextIndent(_) => Self::TEXT_INDENT,
Self::TextAlign(_) => Self::TEXT_ALIGN,
Self::BlockAlign(_) => Self::BLOCK_ALIGN,
Self::InlineAlign(_) => Self::INLINE_ALIGN,
Self::TableBorderStyle(_) => Self::TABLE_BORDER_STYLE,
Self::TablePadding(_) => Self::TABLE_PADDING,
Self::BaselineShift(_) => Self::BASELINE_SHIFT,
Self::LineHeight(_) => Self::LINE_HEIGHT,
Self::TextDecorationColor(_) => Self::TEXT_DECORATION_COLOR,
Self::TextDecorationThickness(_) => Self::TEXT_DECORATION_THICKNESS,
Self::TextDecorationType(_) => Self::TEXT_DECORATION_TYPE,
Self::GlyphOrientationVertical(_) => Self::GLYPH_ORIENTATION_VERTICAL,
Self::ColumnCount(_) => Self::COLUMN_COUNT,
Self::ColumnGap(_) => Self::COLUMN_GAP,
Self::ColumnWidths(_) => Self::COLUMN_WIDTHS,
}
}
}