Add shortcuts for commonly used functions

This commit is contained in:
2024-11-27 15:57:18 +00:00
parent db5a01afef
commit 56d6b95c53
5 changed files with 20 additions and 24 deletions

View File

@@ -37,6 +37,10 @@ impl ContentBuilder {
}
}
pub fn add_text_part<T: Into<String>>(self, text: T) -> Self {
self.add_part(Part::Text(text.into()))
}
pub fn add_part(mut self, part: Part) -> Self {
match &mut self.content.parts {
Some(parts) => parts.push(part),