dope_sys/memory/
cleanup.rs1use std::convert::Infallible;
2
3pub trait Cleanup<P>: Sized {
5 type Error;
6
7 fn primary(&self) -> P;
8 fn failure(&self) -> Self::Error;
9 fn try_close(self, report: impl FnMut(Self::Error)) -> Result<P, Self>;
10}
11
12impl<P> Cleanup<P> for Infallible {
13 type Error = P;
14
15 fn primary(&self) -> P {
16 match *self {}
17 }
18
19 fn failure(&self) -> P {
20 match *self {}
21 }
22
23 fn try_close(self, _: impl FnMut(Self::Error)) -> Result<P, Self> {
24 match self {}
25 }
26}