logo
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
use syn::{
    parse::{Parse, ParseStream},
    Result, Token,
};

use crate::widgets::Tracker;

impl Parse for Tracker {
    fn parse(input: ParseStream) -> Result<Self> {
        let bool_fn = input.parse()?;

        let mut update_fns = Vec::new();
        while !input.is_empty() {
            let _comma: Token![,] = input.parse()?;
            // allow comma at the end of the macro
            if !input.is_empty() {
                update_fns.push(input.parse()?);
            }
        }

        Ok(Tracker {
            bool_fn,
            update_fns,
        })
    }
}