matthewdown/blocks/
photo.rs

1use super::*;
2
3struct Photo
4{
5    href: String
6}
7
8impl walker::Block for Photo
9{
10    fn block_region(&self) -> Option<visitor::Region>
11    {
12        Some(visitor::Region::Photo(self.href.clone()))
13    }
14}
15
16pub struct Command;
17
18impl command::Command<command::Block> for Command
19{
20    type Positional = (String,);
21    type Named      = command::NoNamed;
22
23    fn create<'a>(&self, args: Self::Positional, _: Self::Named)
24        -> Result<Box<dyn walker::Block + 'a>>
25    {
26        Ok(Box::new(Photo { href: args.0 }))
27    }
28
29    fn name(&self) -> &'static str { "photo" }
30}