rstmt_traits/ops/
transform.rs1pub trait Transform<Rhs> {
10 type Output;
11
12 fn transform(&self, rhs: Rhs) -> Self::Output;
13}
14pub trait TryTransform<Rhs> {
16 type Output;
17 type Error;
18
19 fn try_transform(&self, rhs: Rhs) -> Result<Self::Output, Self::Error>;
20}
21
22impl<X, Y, A> TryTransform<X> for A
27where
28 A: Transform<X, Output = Y>,
29{
30 type Output = Y;
31 type Error = core::convert::Infallible;
32
33 fn try_transform(&self, rhs: X) -> Result<Y, Self::Error> {
34 Ok(<A as Transform<X>>::transform(self, rhs))
35 }
36}