mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 04:11:09 +00:00
FRAME: Introduce ConvertToValue adapter (#14270)
This commit is contained in:
@@ -530,6 +530,15 @@ impl<A, B: Default> Convert<A, B> 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<T>(sp_std::marker::PhantomData<T>);
|
||||||
|
impl<X, Y, T: Get<Y>> Convert<X, Y> for ConvertToValue<T> {
|
||||||
|
fn convert(_: X) -> Y {
|
||||||
|
T::get()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A structure that performs identity conversion.
|
/// A structure that performs identity conversion.
|
||||||
pub struct Identity;
|
pub struct Identity;
|
||||||
impl<T> Convert<T, T> for Identity {
|
impl<T> Convert<T, T> for Identity {
|
||||||
|
|||||||
Reference in New Issue
Block a user