1use clap::Parser;
9use std::error::Error;
10
11pub mod ber;
12pub mod ccsds;
13pub mod ccsds_c2;
14pub mod dvbs2;
15pub mod encode;
16pub mod mackay_neal;
17pub mod nr5g;
18pub mod peg;
19pub mod systematic;
20
21pub trait Run {
23 fn run(&self) -> Result<(), Box<dyn Error>>;
25}
26
27#[derive(Debug, Parser)]
29#[command(author, version, name = "ldpc-toolbox", about = "LDPC toolbox")]
30pub enum Args {
31 #[command(name = "5g")]
33 NR5G(nr5g::Args),
34 BER(ber::Args),
36 CCSDS(ccsds::Args),
38 #[allow(non_camel_case_types)]
40 CCSDS_C2(ccsds_c2::Args),
41 Encode(encode::Args),
43 DVBS2(dvbs2::Args),
45 MackayNeal(mackay_neal::Args),
47 PEG(peg::Args),
49 Systematic(systematic::Args),
51}
52
53impl Run for Args {
54 fn run(&self) -> Result<(), Box<dyn Error>> {
55 match self {
56 Args::BER(x) => x.run(),
57 Args::CCSDS(x) => x.run(),
58 Args::CCSDS_C2(x) => x.run(),
59 Args::DVBS2(x) => x.run(),
60 Args::Encode(x) => x.run(),
61 Args::MackayNeal(x) => x.run(),
62 Args::NR5G(x) => x.run(),
63 Args::PEG(x) => x.run(),
64 Args::Systematic(x) => x.run(),
65 }
66 }
67}