1 2 3 4 5 6 7 8 9 10 11 12 13 14
pub trait FnOnceOutput<In> { type Out; fn call(self, x: In) -> Self::Out; } impl<In, F, O> FnOnceOutput<In> for F where F: FnOnce(In) -> O, { type Out = O; fn call(self, x: In) -> Self::Out { self(x) } }