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
34
#[cfg(feature = "ext_fast_image_resize")]
mod feat {
    use crate::*;
    use fast_image_resize::FilterType;

    impl Ast for FilterType {
        fn ast() -> String {
            format!("*\"ext_fast_image_resize\"")
        }
    }

    impl Bytes for FilterType {
        fn from_bytes<W: ParseBytes>(buf: &mut W) -> Res<Self> {
            use FilterType::*;

            if !buf.read_bool()? {
                return Ok(Self::default());
            }

            Ok({
                let name = buf.read_string()?;

                match name.as_str() {
                    "FilterType::Box" => Box,
                    "FilterType::CatmullRom" => CatmullRom,
                    "FilterType::Hamming" => Hamming,
                    "FilterType::Lanczos3" => Lanczos3,
                    "FilterType::Mitchell" => Mitchell,
                    _ => return Err(MyErr::Todo),
                }
            })
        }
    }
}