Trait TwoWay

Source
pub trait TwoWay: OneWay {
    // Required method
    fn other_way(
        src: <Self as OneWay>::Dest,
    ) -> Result<<Self as OneWay>::Source>;
}
Expand description

A trait for 2-way conversions that may fail.

Of course, for any x: Source, it should be the case that other_way(one_way(x)?)? == x when possible, but this is not required.

Required Methods§

Source

fn other_way(src: <Self as OneWay>::Dest) -> Result<<Self as OneWay>::Source>

Conversion from Dest to Source that may fail.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S, D> TwoWay for DefConv<S, D>
where Self: OneWay<Source = S, Dest = D>, DefConv<D, S>: OneWay<Source = D, Dest = S>,