rust_elm/testing/
macros.rs1#[macro_export]
5macro_rules! total_update {
6 ($state:expr, $action:expr, {
7 $($variant:pat => $body:expr,)*
8 _ => $default:expr
9 }) => {{
10 match $action {
11 $($variant => $body,)*
12 _ => $default,
13 }
14 }};
15}
16
17#[macro_export]
19macro_rules! arbitrary_msg {
20 ($name:ident { $($variant:ident),* $(,)? }) => {
21 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
22 pub enum $name {
23 $($variant,)*
24 }
25
26 impl $name {
27 pub fn all() -> &'static [$name] {
28 &[$(Self::$variant,)*]
29 }
30 }
31 };
32}
33
34#[macro_export]
36macro_rules! reducers {
37 ($($r:expr),+ $(,)?) => {
38 $crate::reducer::CombineReducers((
39 $( $crate::reducer::coerce_fn($r) ),+
40 ))
41 };
42}