half-finish backend macro
i cannot figure out how procedural macros work actually
This commit is contained in:
@@ -42,39 +42,6 @@ macro_rules! impl_backend_constants {
|
||||
};
|
||||
}
|
||||
|
||||
// #[macro_export]
|
||||
// macro_rules! register_backends {
|
||||
// ($first:ident, $($name:ident),*) => {
|
||||
// #[derive(Debug, Hash, PartialEq, Eq)]
|
||||
// pub(crate) enum Backends {
|
||||
// $first,
|
||||
// $(
|
||||
// $name,
|
||||
// )*
|
||||
// }
|
||||
//
|
||||
// impl Backends {
|
||||
// pub fn iter() -> BackendIter {
|
||||
// BackendIter {
|
||||
// next: Some(Backends::$first),
|
||||
// }
|
||||
// }
|
||||
// fn next(&self) -> Option<Self> {
|
||||
// match self {
|
||||
// $(
|
||||
// Self::$name => match $name {
|
||||
// $(
|
||||
// _ => Some(Self::$name),
|
||||
// )*
|
||||
// _ => None
|
||||
// },
|
||||
// )*
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! register_backends {
|
||||
($first:ident, $($name:ident),*) => {
|
||||
@@ -93,14 +60,6 @@ macro_rules! register_backends {
|
||||
}
|
||||
}
|
||||
|
||||
fn next(&self) -> Option<Self> {
|
||||
println!("Some({:?})", Self::$first);
|
||||
$(
|
||||
println!("{:?}", Self::$name);
|
||||
)*
|
||||
None
|
||||
}
|
||||
|
||||
fn get_backend(&self) -> Box<dyn Backend> {
|
||||
match self {
|
||||
Self::$first => Box::new($first::new()),
|
||||
|
||||
Reference in New Issue
Block a user