bunbun/src/template_args.rs

23 lines
452 B
Rust
Raw Normal View History

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