mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 23:21:02 +00:00
Impl InherentDataProviderExt for more tuples (#9282)
* Impl InherentDataProviderExt for more tuples Currently the inherent data provider only supports up to 4 entries due to the limit of InherentDataProviderExt, which is not enough for a chain with more than 4 inherent data providers. This patch simply impls InherentDataProviderExt for more tuples. * Nit * Apply suggestions from code review Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
This commit is contained in:
@@ -454,47 +454,36 @@ pub trait InherentDataProviderExt {
|
|||||||
fn slot(&self) -> Slot;
|
fn slot(&self) -> Slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, S, P> InherentDataProviderExt for (T, S, P)
|
/// Small macro for implementing `InherentDataProviderExt` for inherent data provider tuple.
|
||||||
where
|
macro_rules! impl_inherent_data_provider_ext_tuple {
|
||||||
T: Deref<Target = Timestamp>,
|
( T, S $(, $TN:ident)* $( , )?) => {
|
||||||
S: Deref<Target = Slot>,
|
impl<T, S, $( $TN ),*> InherentDataProviderExt for (T, S, $($TN),*)
|
||||||
{
|
where
|
||||||
fn timestamp(&self) -> Timestamp {
|
T: Deref<Target = Timestamp>,
|
||||||
*self.0.deref()
|
S: Deref<Target = Slot>,
|
||||||
}
|
{
|
||||||
|
fn timestamp(&self) -> Timestamp {
|
||||||
|
*self.0.deref()
|
||||||
|
}
|
||||||
|
|
||||||
fn slot(&self) -> Slot {
|
fn slot(&self) -> Slot {
|
||||||
*self.1.deref()
|
*self.1.deref()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, S, P, R> InherentDataProviderExt for (T, S, P, R)
|
impl_inherent_data_provider_ext_tuple!(T, S);
|
||||||
where
|
impl_inherent_data_provider_ext_tuple!(T, S, A);
|
||||||
T: Deref<Target = Timestamp>,
|
impl_inherent_data_provider_ext_tuple!(T, S, A, B);
|
||||||
S: Deref<Target = Slot>,
|
impl_inherent_data_provider_ext_tuple!(T, S, A, B, C);
|
||||||
{
|
impl_inherent_data_provider_ext_tuple!(T, S, A, B, C, D);
|
||||||
fn timestamp(&self) -> Timestamp {
|
impl_inherent_data_provider_ext_tuple!(T, S, A, B, C, D, E);
|
||||||
*self.0.deref()
|
impl_inherent_data_provider_ext_tuple!(T, S, A, B, C, D, E, F);
|
||||||
}
|
impl_inherent_data_provider_ext_tuple!(T, S, A, B, C, D, E, F, G);
|
||||||
|
impl_inherent_data_provider_ext_tuple!(T, S, A, B, C, D, E, F, G, H);
|
||||||
fn slot(&self) -> Slot {
|
impl_inherent_data_provider_ext_tuple!(T, S, A, B, C, D, E, F, G, H, I);
|
||||||
*self.1.deref()
|
impl_inherent_data_provider_ext_tuple!(T, S, A, B, C, D, E, F, G, H, I, J);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T, S> InherentDataProviderExt for (T, S)
|
|
||||||
where
|
|
||||||
T: Deref<Target = Timestamp>,
|
|
||||||
S: Deref<Target = Slot>,
|
|
||||||
{
|
|
||||||
fn timestamp(&self) -> Timestamp {
|
|
||||||
*self.0.deref()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn slot(&self) -> Slot {
|
|
||||||
*self.1.deref()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Start a new slot worker.
|
/// Start a new slot worker.
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user