Skip to main content

pidgin_lang/
ast.rs

1use std::collections::BTreeMap;
2
3#[derive(Debug, Clone, PartialEq)]
4pub enum Directive {
5    Run,
6    Result,
7    Approval,
8    Context,
9}
10
11impl Directive {
12    pub fn directive_name(&self) -> &'static str {
13        match self {
14            Directive::Run => "run",
15            Directive::Result => "result",
16            Directive::Approval => "approval",
17            Directive::Context => "context",
18        }
19    }
20}
21
22#[derive(Debug, Clone, PartialEq)]
23pub enum FieldValue {
24    Scalar(String),
25    List(Vec<String>),
26}
27
28#[derive(Debug, Clone, PartialEq)]
29pub struct PgnPacket {
30    pub directive: Directive,
31    pub run_id: String,
32    pub fields: BTreeMap<String, FieldValue>,
33}