mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-17 13:17:55 +08:00
0ff940871b
Reasons: - More idiomatic use of string. Considering that they are constants, I don't anticipate any performance gains related to heap-allocation. Signed-off-by: Perma Alesheikh <me@prma.dev>
26 lines
555 B
Rust
26 lines
555 B
Rust
use clap::Parser;
|
|
use std::ops::Deref;
|
|
|
|
/// The raw template body argument parser.
|
|
#[derive(Debug, Parser)]
|
|
pub struct TemplateRawBodyArg {
|
|
/// Prefill the template with a custom MML body.
|
|
#[arg(trailing_var_arg = true)]
|
|
#[arg(name = "body_raw", value_name = "BODY")]
|
|
pub raw: Vec<String>,
|
|
}
|
|
|
|
impl TemplateRawBodyArg {
|
|
pub fn raw(self) -> String {
|
|
self.raw.join(" ").replace('\r', "")
|
|
}
|
|
}
|
|
|
|
impl Deref for TemplateRawBodyArg {
|
|
type Target = Vec<String>;
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
&self.raw
|
|
}
|
|
}
|