1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
//! invoke helper pub trait Invoke<A> { type Result; fn invoke(self, arg: A) -> Self::Result; } pub struct Identity; impl<A> Invoke<A> for Identity { type Result = A; fn invoke(self, arg: A) -> A { arg } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
//! invoke helper pub trait Invoke<A> { type Result; fn invoke(self, arg: A) -> Self::Result; } pub struct Identity; impl<A> Invoke<A> for Identity { type Result = A; fn invoke(self, arg: A) -> A { arg } }