referrerpolicy=no-referrer-when-downgrade
sp_runtime::traits

Trait Convert

Source
pub trait Convert<A, B> {
    // Required method
    fn convert(a: A) -> B;
}
Expand description

Infallible conversion trait. Generic over both source and destination types.

Required Methods§

Source

fn convert(a: A) -> B

Make conversion.

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.

Implementations on Foreign Types§

Source§

impl<A, B: Default> Convert<A, B> for ()

Source§

fn convert(_: A) -> B

Implementors§

Source§

impl<A: Into<B>, B> Convert<A, B> for ConvertInto

Source§

impl<T> Convert<T, T> for Identity

Source§

impl<X, Y, T: Get<Y>> Convert<X, Y> for ConvertToValue<T>

impl<Equivalence, AssetId, L> Convert<L, Either<AssetId, L>> for LocalFromLeft<Equivalence, AssetId, L>
where Equivalence: MaybeEquivalence<L, AssetId>,

impl<Target: Get<L>, L: PartialEq + Eq> Convert<L, Either<(), L>> for TargetFromLeft<Target, L>

impl<Fungible> Convert<u16, u128> for RankToSalary<Fungible>
where Fungible: Inspect<AccountId, Balance = Balance>,

impl<AssetId: Ord> Convert<NativeOrWithId<AssetId>, Either<(), AssetId>> for NativeFromLeft

impl<Base, Slope, Balance> Convert<Footprint, Balance> for LinearStoragePrice<Base, Slope, Balance>
where Base: Get<Balance>, Slope: Get<Balance>, Balance: From<u64> + Saturating,

impl<Price, Balance> Convert<Footprint, Balance> for ConstantStoragePrice<Price, Balance>
where Price: Get<Balance>, Balance: From<u64> + Saturating,

impl Convert<u128, U256> for BalanceToU256

impl Convert<U256, u128> for U256ToBalance

impl Convert<Public, Vec<u8>> for BeefyEcdsaToEthereum

impl<T> Convert<T, Option<T>> for IdentityCollator

impl<Ceil, Deposit, Balance> Convert<u32, Balance> for WithCeil<Ceil, Deposit>
where Ceil: Get<Balance>, Deposit: Convert<u32, Balance>, Balance: Balance,

impl<Delay, Deposit, Balance> Convert<u32, Balance> for Delayed<Delay, Deposit>
where Delay: Get<u32>, Deposit: Convert<u32, Balance>, Balance: Balance,

impl<Deposit, Balance> Convert<u32, Balance> for Constant<Deposit>
where Deposit: Get<Balance>, Balance: Balance,

impl<Period, Step, Balance> Convert<u32, Balance> for Stepped<Period, Step>
where Period: Get<u32>, Step: Convert<u32, Balance>, Balance: Balance,

impl<Precision, Deposit, Balance> Convert<u32, Balance> for Round<Precision, Deposit>
where Precision: Get<u32>, Deposit: Convert<u32, Balance>, Balance: Balance,

impl<Ratio, Base, Balance> Convert<u32, Balance> for Geometric<Ratio, Base>
where Ratio: Get<FixedU128>, Base: Get<Balance>, Balance: Balance,

impl<Slope, Offset, Balance> Convert<u32, Balance> for Linear<Slope, Offset>
where Slope: Get<u32>, Offset: Get<Balance>, Balance: Balance,

impl<T: From<u64>> Convert<Weight, T> for TestDefaultConfig

impl<Balance, Fixed, Inc> Convert<usize, Balance> for GeometricDepositBase<Balance, Fixed, Inc>
where Balance: FixedPointOperand, Fixed: Get<Balance>, Inc: Get<Percent>,

impl<A: TypedGet> Convert<Perquintill, <A as TypedGet>::Type> for WithMaximumOf<A>
where A::Type: Clone + Unsigned + From<u64>, u64: TryFrom<A::Type>,

impl<T> Convert<Perquintill, u32> for NoCounterpart<T>

impl Convert<u128, U256> for BalanceToU256

impl Convert<U256, u128> for U256ToBalance

impl Convert<u16, u32> for Geometric

impl Convert<u16, u32> for Linear

impl Convert<u16, u32> for Unit

impl<T: From<u64>> Convert<Weight, T> for TestDefaultConfig

impl<T: Config> Convert<<T as Config>::AccountId, Option<<T as Config>::AccountId>> for StashOf<T>

impl<T: Config> Convert<<T as Config>::AccountId, Option<ExistenceOrLegacyExposure<<T as Config>::AccountId, <T as Config>::CurrencyBalance>>> for ExistenceOrLegacyExposureOf<T>

impl<T: Config> Convert<<T as Config>::AccountId, Option<()>> for ExistenceOf<T>

impl<T: Config> Convert<<T as Config>::AccountId, Option<Exposure<<T as Config>::AccountId, <T as Config>::CurrencyBalance>>> for ExposureOf<T>

impl<M> Convert<FixedU128, FixedU128> for ConstFeeMultiplier<M>
where M: Get<Multiplier>,

impl<T> Convert<Weight, <<T as Config>::OnChargeTransaction as OnChargeTransaction<T>>::Balance> for Pallet<T>
where T: Config,

impl<T, S, V, M, X> Convert<FixedU128, FixedU128> for TargetedFeeAdjustment<T, S, V, M, X>
where T: Config, S: Get<Perquintill>, V: Get<Multiplier>, M: Get<Multiplier>, X: Get<Multiplier>,

impl Convert<Id, AggregateMessageOrigin> for ParaIdToSibling

impl Convert<u128, U256> for BalanceToU256

impl Convert<U256, u128> for U256ToBalance