1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use avro_rs::types::Value;
use avro_rs::Schema;
use serde::Serialize;

/// This trait is used for structures that represent STRMPrivacy
/// schemas
pub trait StrmPrivacyValue: Serialize + Clone {
    const STRM_SCHEMA_REF: &'static str;
    const STRM_SCHEMA: &'static str;

    fn get_schema(schema: &'static str) -> Schema {
        Schema::parse_str(schema).unwrap()
    }

    fn avro_value(&self) -> Value {
        avro_rs::to_value(&self).unwrap()
    }
}