Skip to main content

lexe_api_core/
macros.rs

1/// Build the user agent string used for requests to Lexe infrastructure at
2/// compile time. We format as `<crate>/<version>`, consistent with
3/// [RFC 9110 Section 10.1.5](https://datatracker.ietf.org/doc/html/rfc9110#section-10.1.5).
4///
5/// Example: "node/0.6.20".
6#[macro_export]
7macro_rules! user_agent_to_lexe {
8    () => {
9        concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"))
10    };
11}
12
13/// Build the user agent string used for requests to external services at
14/// compile time.
15///
16/// Example: "lexe-node/0.6.20".
17#[macro_export]
18macro_rules! user_agent_to_external {
19    () => {
20        concat!("lexe-", $crate::user_agent_to_lexe!())
21    };
22}