pub struct Meta {
pub key: String,
pub value: String,
}Expand description
A simple struct to store the key value pair from within the meta section of a Markdown file.
§Example
use blogs_md_easy::{parse_meta_line, Meta, Span};
let input = Span::new("foo = bar");
let (_, meta) = parse_meta_line(input).unwrap();
// Unwrap because key-values are Some() and comments are None.
let meta = meta.unwrap();
assert_eq!(meta, Meta::new("foo", "bar"));Fields§
§key: String§value: StringImplementations§
Source§impl Meta
impl Meta
Sourcepub fn new(key: &str, value: &str) -> Self
pub fn new(key: &str, value: &str) -> Self
Trims the key and value and stores them in the respective values in
this struct.
§Example
use blogs_md_easy::Meta;
let meta_with_space = Meta::new(" foo ", " bar ");
let meta_without_space = Meta::new("foo", "bar");
assert_eq!(meta_with_space, meta_without_space);Trait Implementations§
Auto Trait Implementations§
impl Freeze for Meta
impl RefUnwindSafe for Meta
impl Send for Meta
impl Sync for Meta
impl Unpin for Meta
impl UnwindSafe for Meta
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