diff --git a/primitives/runtime/src/traits.rs b/primitives/runtime/src/traits.rs index d1fda9f3d5256..a2af0b778040b 100644 --- a/primitives/runtime/src/traits.rs +++ b/primitives/runtime/src/traits.rs @@ -530,6 +530,15 @@ impl Convert for () { } } +/// Adapter which turns a `Get` implementation into a `Convert` implementation which always returns +/// in the same value no matter the input. +pub struct ConvertToValue(sp_std::marker::PhantomData); +impl> Convert for ConvertToValue { + fn convert(_: X) -> Y { + T::get() + } +} + /// A structure that performs identity conversion. pub struct Identity; impl Convert for Identity {