Macro malachite_base::union_struct
source ยท macro_rules! union_struct { ( ($($vis:tt)*), $name: ident, $single: ty, $([$t: ident, $cons: ident, $c: expr, $x: ident]),* ) => { ... }; }
Expand description
Defines unions.
Malachite provides Union2
, but you can also define Union3
, Union4
, and so on, in your
program using the code below. The documentation for Union2
and describes these other enum
s
as well.
use malachite_base::union_struct;
use malachite_base::unions::UnionFromStrError;
use std::fmt::{self, Display, Formatter};
use std::str::FromStr;
union_struct!(
(pub(crate)),
Union3,
Union3<T, T, T>,
[A, A, 'A', a],
[B, B, 'B', b],
[C, C, 'C', c]
);
union_struct!(
(pub(crate)),
Union4,
Union4<T, T, T, T>,
[A, A, 'A', a],
[B, B, 'B', b],
[C, C, 'C', c],
[D, D, 'D', d]
);
union_struct!(
(pub(crate)),
Union5,
Union5<T, T, T, T, T>,
[A, A, 'A', a],
[B, B, 'B', b],
[C, C, 'C', c],
[D, D, 'D', d],
[E, E, 'E', e]
);
union_struct!(
(pub(crate)),
Union6,
Union6<T, T, T, T, T, T>,
[A, A, 'A', a],
[B, B, 'B', b],
[C, C, 'C', c],
[D, D, 'D', d],
[E, E, 'E', e],
[F, F, 'F', f]
);
union_struct!(
(pub(crate)),
Union7,
Union7<T, T, T, T, T, T, T>,
[A, A, 'A', a],
[B, B, 'B', b],
[C, C, 'C', c],
[D, D, 'D', d],
[E, E, 'E', e],
[F, F, 'F', f],
[G, G, 'G', g]
);
union_struct!(
(pub(crate)),
Union8,
Union8<T, T, T, T, T, T, T, T>,
[A, A, 'A', a],
[B, B, 'B', b],
[C, C, 'C', c],
[D, D, 'D', d],
[E, E, 'E', e],
[F, F, 'F', f],
[G, G, 'G', g],
[H, H, 'H', h]
);