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
35
36
37
38
39
use std::fmt;

use necsim_core::{impl_report, reporter::Reporter};

#[allow(clippy::module_name_repetitions)]
#[derive(Default)]
pub struct VerboseReporter(());

impl fmt::Debug for VerboseReporter {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        fmt.debug_struct(stringify!(VerboseReporter)).finish()
    }
}

impl serde::Serialize for VerboseReporter {
    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        serializer.serialize_unit()
    }
}

impl<'de> serde::Deserialize<'de> for VerboseReporter {
    fn deserialize<D: serde::Deserializer<'de>>(_deserializer: D) -> Result<Self, D::Error> {
        Ok(Self::default())
    }
}

impl Reporter for VerboseReporter {
    impl_report!(speciation(&mut self, speciation: Used) {
        info!("{:#?}", speciation);
    });

    impl_report!(dispersal(&mut self, dispersal: Used) {
        info!("{:#?}", dispersal);
    });

    impl_report!(progress(&mut self, remaining: Used) {
        info!("Remaining: {}", remaining);
    });
}