Define RangeInclusiveExt (#2037)

* Define RangeInclusiveExt

* Use RangeInclusiveExt

* Add docs
This commit is contained in:
Serban Iorga
2023-04-13 10:38:34 +03:00
committed by Bastian Köcher
parent ea39f4c0d2
commit b8f4086095
5 changed files with 26 additions and 32 deletions
@@ -115,22 +115,6 @@ pub enum CallInfo {
ReceiveMessagesDeliveryProof(ReceiveMessagesDeliveryProofInfo),
}
impl CallInfo {
/// Returns number of messages, bundled with this transaction.
pub fn bundled_messages(&self) -> MessageNonce {
let bundled_range = match *self {
Self::ReceiveMessagesProof(ref info) => &info.base.bundled_range,
Self::ReceiveMessagesDeliveryProof(ref info) => &info.0.bundled_range,
};
bundled_range
.end()
.checked_sub(*bundled_range.start())
.map(|d| d.saturating_add(1))
.unwrap_or(0)
}
}
/// Helper struct that provides methods for working with a call supported by `CallInfo`.
pub struct CallHelper<T: Config<I>, I: 'static> {
pub _phantom_data: sp_std::marker::PhantomData<(T, I)>,