pub trait MaybeEquivalence<A, B> {
// Required methods
fn convert(a: &A) -> Option<B>;
fn convert_back(b: &B) -> Option<A>;
}
Expand description
Definition for a bi-directional, fallible conversion between two types.
Required Methods§
Sourcefn convert(a: &A) -> Option<B>
fn convert(a: &A) -> Option<B>
Attempt to convert reference of A
into value of B
, returning None
if not possible.
Sourcefn convert_back(b: &B) -> Option<A>
fn convert_back(b: &B) -> Option<A>
Attempt to convert reference of B
into value of A
, returning None
if not possible.
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.