tilo_resource/
search_preview.rs1#[derive(Clone, Debug, Default, PartialEq, Eq)]
7pub struct SearchPreview {
8 pub title: Option<String>,
9 pub facts: Vec<String>,
10 pub lines: Vec<String>,
11 pub body: Option<String>,
12}
13
14impl SearchPreview {
15 #[must_use]
17 pub fn titled(title: impl Into<String>) -> Self {
18 Self {
19 title: Some(title.into()),
20 ..Self::default()
21 }
22 }
23
24 #[must_use]
26 pub fn fact(mut self, fact: impl Into<String>) -> Self {
27 self.facts.push(fact.into());
28 self
29 }
30
31 #[must_use]
33 pub fn line(mut self, line: impl Into<String>) -> Self {
34 self.lines.push(line.into());
35 self
36 }
37
38 #[must_use]
40 pub fn body(mut self, body: impl Into<String>) -> Self {
41 self.body = Some(body.into());
42 self
43 }
44}