exemplify_lib/layers/domain/entities/
example.rs

1use crate::layers::domain::entities::Printable;
2
3pub struct Example {
4    pub name: String,
5    pub content: Vec<String>,
6    pub title: Option<String>,
7    pub language: Option<String>,
8    pub id: Option<String>
9}
10
11impl Example {
12    pub fn new(name: String, content: Vec<String>, title: Option<String>, language: Option<String>, id: Option<String>) -> Example {
13        Example {
14            name,
15            content,
16            title,
17            language,
18            id
19        }
20    }
21}
22
23impl Printable for Example {
24    fn print(&self) -> String {
25        self.content.join("\n")
26    }
27
28    fn file_name(&self) -> String {
29        self.name.clone()
30    }
31}