Extract config text parsing into the type
This commit is contained in:
parent
0c2f9707cd
commit
99b9feeb95
3 changed files with 22 additions and 15 deletions
18
src/types.rs
18
src/types.rs
|
|
@ -2,6 +2,8 @@ use std::collections::HashMap;
|
|||
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
use crate::syntax::content::parsers::{compound::elements::literal::Literal, line::elements::{paragraph::Paragraph, span::Span}};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Default, PartialEq, Eq, Debug)]
|
||||
pub struct Graph {
|
||||
pub nodes: HashMap<String, Node>,
|
||||
|
|
@ -149,3 +151,19 @@ impl Node {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
#[must_use]
|
||||
pub fn parse_text(self) -> Config {
|
||||
|
||||
Config {
|
||||
footer_text: crate::syntax::content::parse::<Span, Literal>(
|
||||
&self.footer_text,
|
||||
),
|
||||
about_text: crate::syntax::content::parse::<Paragraph, Literal>(
|
||||
&self.about_text,
|
||||
),
|
||||
..self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue