Files
himalaya/src/email/message/template/arg/body.rs
T
Perma Alesheikh 0ff940871b use char when replacing a single character
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>
2024-01-09 21:55:20 +01:00

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
}
}