1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use typemap::ShareDebugMap;

pub trait DrainTrace {
    fn drain_trace(self, map: &mut ShareDebugMap);
}

impl<T: DrainTrace> DrainTrace for Option<T> {
    fn drain_trace(self, map: &mut ShareDebugMap) {
        if let Some(x) = self {
            x.drain_trace(map);
        }
    }
}

impl DrainTrace for () {
    fn drain_trace(self, _map: &mut ShareDebugMap) {}
}