2022-06-02 21:58:56 -07:00
|
|
|
use std::borrow::Cow;
|
|
|
|
|
|
|
|
use percent_encoding::PercentEncode;
|
2019-12-22 21:08:16 -08:00
|
|
|
use serde::Serialize;
|
|
|
|
|
2022-06-02 21:58:56 -07:00
|
|
|
pub fn query<'a>(query: PercentEncode<'a>) -> impl Serialize + 'a {
|
2019-12-22 21:08:16 -08:00
|
|
|
#[derive(Serialize)]
|
2022-06-02 21:58:56 -07:00
|
|
|
struct TemplateArgs<'a> {
|
|
|
|
query: Cow<'a, str>,
|
|
|
|
}
|
|
|
|
TemplateArgs {
|
|
|
|
query: query.into(),
|
2019-12-22 21:08:16 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-02 21:58:56 -07:00
|
|
|
pub fn hostname<'a>(hostname: &'a str) -> impl Serialize + 'a {
|
2019-12-22 21:08:16 -08:00
|
|
|
#[derive(Serialize)]
|
2022-06-02 21:58:56 -07:00
|
|
|
pub struct TemplateArgs<'a> {
|
|
|
|
pub hostname: &'a str,
|
2019-12-22 21:08:16 -08:00
|
|
|
}
|
|
|
|
TemplateArgs { hostname }
|
|
|
|
}
|