1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use std::fmt::Debug;

#[macro_export]
macro_rules! impl_trait_for {
	($trait: ty = $($types: ty),+) => {
		$(impl $trait for $types {})+
	};
}

// TODO replace with trait aliases
macro_rules! trait_alias {
	($t: ident, $($b: tt)+ ) => {
		pub trait $t: $($b)+ {}
		impl<T: $($b)+> $t for T {}
	};
}

trait_alias!(SendStat, 'static + Send);

#[cfg(feature = "adv_fs")]
trait_alias!(TrivialBound, 'static + Debug + Default + Copy + PartialEq + serde::Serialize + serde::de::DeserializeOwned);
#[cfg(not(feature = "adv_fs"))]
trait_alias!(TrivialBound, 'static + Debug + Default + Copy + PartialEq);

macro_rules! derive_common_VAL {
	($($t: tt)+) => {
		#[derive(Default, Debug, Clone, Copy, PartialEq)]
		#[cfg_attr(feature = "adv_fs", derive(serde::Serialize, serde::Deserialize))]
		$($t)+
	};
}

macro_rules! derive_common_OBJ {
	($($t: tt)+) => {
		#[derive(Default, Debug, Clone)]
		#[cfg_attr(feature = "adv_fs", derive(serde::Serialize, serde::Deserialize))]
		$($t)+
	};
}