fuel_streams_macros/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#![doc = include_str!("../README.md")]

pub mod subject {
    pub use subject_derive::*;

    /// This trait is used internally by the `Subject` derive macro to convert a struct into a
    /// standard NATS subject.
    pub trait IntoSubject: std::fmt::Debug + Send + Sync {
        fn parse(&self) -> String;
        fn wildcard(&self) -> &'static str;
    }

    pub trait SubjectBuildable: std::fmt::Debug {
        fn new() -> Self;
    }

    pub fn parse_param<V: ToString>(param: &Option<V>) -> String {
        match param {
            Some(val) => val.to_string(),
            None => "*".to_string(),
        }
    }
}