add derive Register macro

This commit is contained in:
timeshifter
2023-01-12 23:07:27 +01:00
parent 73df8e8f42
commit 1b5302e459
9 changed files with 189 additions and 47 deletions
+5 -15
View File
@@ -9,28 +9,18 @@ use std::process::Command;
use anyhow::{Context, Result};
use crate::register_backends;
use crate::{Group, Package};
use pacdef_macro::Register;
pub(crate) use todo_per_backend::ToDoPerBackend;
pub(in crate::backend) type Switches = &'static [&'static str];
pub(in crate::backend) type Text = &'static str;
register_backends!(Pacman, Rust);
// TODO find a way to include this in the `register_backends!` macro
pub(crate) use pacman::Pacman;
pub(crate) use rust::Rust;
// TODO find a way to include this in the `register_backends!` macro
impl Backends {
fn next(&self) -> Option<Self> {
match self {
Self::Pacman => Some(Self::Rust),
Self::Rust => None,
}
}
#[derive(Debug, Register)]
pub(crate) enum Backends {
Pacman,
Rust,
}
#[derive(Debug)]