ldpc_toolbox/cli/ccsds_c2.rs
1//! CCSDS C2 CLI subcommand
2//!
3//! This subcommand can be used to generate the C2 LDPC code (rate ~7/8)
4//! described in the CCSDS TM Synchronization and Channel Coding Blue Book
5//! standard. It will print the alist of the parity check matrix to
6//! `stdout`. See [`crate::codes::ccsds`] for more information about the CCSDS
7//! LDPC codes.
8//!
9//! # Examples
10//! The parity check matrix can be generated with
11//! ```shell
12//! $ ldpc-toolbox ccsds-c2
13//! ```
14
15use crate::cli::*;
16use crate::codes::ccsds::C2Code;
17use clap::Parser;
18
19/// CCSDS CLI arguments.
20#[derive(Debug, Parser)]
21#[command(about = "Generates the alist of CCSDS C2 LDPC")]
22pub struct Args {}
23
24impl Run for Args {
25 fn run(&self) -> std::result::Result<(), Box<dyn std::error::Error>> {
26 let h = C2Code::new().h();
27 print!("{}", h.alist());
28 Ok(())
29 }
30}