#![deny(missing_docs)]
#[macro_export]
macro_rules! backend_macro_items { ($($x:item)+) => ($($x)+) }
#[macro_export]
macro_rules! backend {
($( $x:ident [$($w:tt)*] ),*) => {backend_macro_items! {
pub trait Associated {
type Backend: Backend;
}
pub trait Backend {
$(
type $x: Associated<Backend = Self> + $($w)*;
)*
}
pub trait OfBackend: Associated {
$(
type $x: $($w)*;
)*
}
impl<T> OfBackend for T where T: Associated {
$(
type $x = <<T as Associated>::Backend as Backend>::$x;
)*
}
}}
}
#[macro_export]
macro_rules! backend_impl {
($x:ident {
$( $($y:ident),+ = $t:path ),*
}) => {
$(
impl Associated for $t {
type Backend = $x;
}
)*
impl Backend for $x {
$(
$( type $y = $t; )*
)*
}
}
}