1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
use properties::parse::fn_name;
use nom::float;
use std::str;

#[derive(Debug, Clone, PartialEq)]
pub struct FilterFunction<'a> {
    pub name: &'a str,
    pub value: f32,
}

named!(pub filter_parse(&[u8]) -> FilterFunction, do_parse!(
  name: fn_name >>
  tag!("(")     >>
  value: float  >>
  tag!(")")     >>
  (FilterFunction {
    name: str::from_utf8(name).unwrap(),
    value,
  })
));