1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Contains the Trait [ViewOpt] for all view options, and the [ViewCommands] enum for the view mode

/// Trait for all view options set by the user.
pub trait ViewOpt {
    /// Type of View to generate.
    fn view(&self) -> Option<ViewCommands>;
}

impl<T> ViewOpt for &T
where
    T: ViewOpt,
{
    fn view(&self) -> Option<ViewCommands> {
        (*self).view()
    }
}

impl<T> ViewOpt for Box<T>
where
    T: ViewOpt,
{
    fn view(&self) -> Option<ViewCommands> {
        (**self).view()
    }
}

impl<T> ViewOpt for std::sync::Arc<T>
where
    T: ViewOpt,
{
    fn view(&self) -> Option<ViewCommands> {
        (**self).view()
    }
}
use clap::Subcommand;
/// Data views that can be generated
#[derive(Subcommand, Copy, Clone, Debug, PartialEq, Eq)]
pub enum ViewCommands {
    /// Print formatted RDHs to stdout
    Rdh,
    /// DEPRECATED! use its-readout-frames instead. Print formatted ITS payload HBFs to stdout, validating the printed words with a Protocol Tracker.
    Hbf,
    /// Print formatted ITS readout frames to stdout
    ItsReadoutFrames,
}