1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use crate::{MarkdownExt, Share};
use equt_md_frontmatter::FrontMatter;
use std::marker::PhantomData;
use std::rc::Rc;
use std::cell::RefCell;
#[derive(Debug)]
pub struct Bottom<T>(PhantomData<T>, Share<RefCell<Option<FrontMatter>>>);
impl<T> Bottom<T> {
pub fn new() -> Bottom<T> {
Bottom (PhantomData, Rc::new(RefCell::new(None)).into())
}
}
impl<T> Iterator for Bottom<T> {
type Item = T;
fn next(&mut self) -> Option<T> {
None
}
}
impl<T> MarkdownExt<T> for Bottom<T> {
fn frontmatter(&mut self) -> &mut Share<RefCell<Option<FrontMatter>>> {
&mut self.1
}
}