stella_docx_kernel/projection/
container.rs1macro_rules! paragraph_containers {
4 ($first:ident => $first_wire:literal $(, $variant:ident => $wire:literal)* $(,)?) => {
5 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
6 pub enum ParagraphContainer {
7 $first,
8 $($variant,)*
9 }
10
11 #[cfg(all(target_arch = "wasm32", feature = "wasm"))]
12 impl ParagraphContainer {
13 pub(crate) const fn wire_name(self) -> &'static str {
14 match self {
15 Self::$first => $first_wire,
16 $(Self::$variant => $wire,)*
17 }
18 }
19 }
20
21 #[cfg(all(target_arch = "wasm32", feature = "wasm"))]
22 #[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
23 const TYPESCRIPT_CONTAINER: &str = concat!(
24 "export type DocxProjectionContainer = ",
25 stringify!($first_wire),
26 $(" | ", stringify!($wire),)*
27 ";",
28 );
29 };
30}
31
32paragraph_containers!(Body => "body", TableCell => "tableCell");