pub struct MetaData {
pub content: String,
pub required: Vec<String>,
pub type_mark: HashMap<String, &'static str>,
}Fields§
§content: String§required: Vec<String>§type_mark: HashMap<String, &'static str>Implementations§
Source§impl MetaData
impl MetaData
pub fn new(content: &str) -> Self
Sourcepub fn parse(&self) -> Result<(HashMap<String, Value>, String)>
pub fn parse(&self) -> Result<(HashMap<String, Value>, String)>
Examples found in repository?
examples/md-meta.rs (line 17)
3fn main() {
4 let content = include_str!("./test.md").to_string();
5
6 let mut type_mark = HashMap::new();
7
8 type_mark.insert("tags".into(), "array");
9 type_mark.insert("released".into(), "bool");
10
11 let meta = markdown_meta_parser::MetaData {
12 content,
13 required: vec!["title".into()],
14 type_mark,
15 };
16
17 println!("{:#?}", meta.parse());
18}pub fn parse_line(text: &str) -> Option<(String, String)>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MetaData
impl RefUnwindSafe for MetaData
impl Send for MetaData
impl Sync for MetaData
impl Unpin for MetaData
impl UnwindSafe for MetaData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more