Skip to main content

typst_tuple

Macro typst_tuple 

Source
macro_rules! typst_tuple {
    ($($x:expr),* $(,)?) => { ... };
}
Expand description

Converts some values to one parenthesized, comma-separated Typst math-mode fragment.

ToTypst is implemented for tuples of up to eight elements. The orphan rule keeps a crate other than this one from implementing it for a longer tuple, so this macro is the way to write such a tuple’s fragment: give it the elements, and it produces what the implementation would have.

§Worst-case complexity

$T(n) = O(n + \sum_{i=0}^{n-1}T^\prime(i))$

$M(n) = O(n + \max_{i=0}^{n-1}M^\prime(i))$

where $T$ is time, $M$ is additional memory, $n$ is the number of elements, $i$ is an element’s index, and $T^\prime$ and $M^\prime$ are the time and memory functions of fmt_typst for that element.

§Examples

use malachite_base::typst_tuple;

let t = (1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8, 8u8, 9u8);
assert_eq!(
    typst_tuple!(t.0, t.1, t.2, t.3, t.4, t.5, t.6, t.7, t.8),
    "(1, 2, 3, 4, 5, 6, 7, 8, 9)"
);