macro_rules! paragraph_containers {
($first:ident => $first_wire:literal $(, $variant:ident => $wire:literal)* $(,)?) => {
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ParagraphContainer {
$first,
$($variant,)*
}
#[cfg(all(target_arch = "wasm32", feature = "wasm"))]
impl ParagraphContainer {
pub(crate) const fn wire_name(self) -> &'static str {
match self {
Self::$first => $first_wire,
$(Self::$variant => $wire,)*
}
}
}
#[cfg(all(target_arch = "wasm32", feature = "wasm"))]
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
const TYPESCRIPT_CONTAINER: &str = concat!(
"export type DocxProjectionContainer = ",
stringify!($first_wire),
$(" | ", stringify!($wire),)*
";",
);
};
}
paragraph_containers!(Body => "body", TableCell => "tableCell");