mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Restructure macro-related exports into private mods for frame (#14375)
* minor refactor * Update frame/election-provider-support/src/lib.rs * Update frame/election-provider-support/solution-type/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: command-bot <>
This commit is contained in:
committed by
GitHub
parent
b78473d28a
commit
7db4d74c43
@@ -194,13 +194,27 @@ use sp_runtime::TryRuntimeError;
|
||||
|
||||
// re-export for the solution macro, with the dependencies of the macro.
|
||||
#[doc(hidden)]
|
||||
pub use codec;
|
||||
#[doc(hidden)]
|
||||
pub use scale_info;
|
||||
#[doc(hidden)]
|
||||
pub use sp_arithmetic;
|
||||
#[doc(hidden)]
|
||||
pub use sp_std;
|
||||
pub mod private {
|
||||
pub use codec;
|
||||
pub use scale_info;
|
||||
pub use sp_arithmetic;
|
||||
pub use sp_std;
|
||||
|
||||
// Simple Extension trait to easily convert `None` from index closures to `Err`.
|
||||
//
|
||||
// This is only generated and re-exported for the solution code to use.
|
||||
pub trait __OrInvalidIndex<T> {
|
||||
fn or_invalid_index(self) -> Result<T, crate::Error>;
|
||||
}
|
||||
|
||||
impl<T> __OrInvalidIndex<T> for Option<T> {
|
||||
fn or_invalid_index(self) -> Result<T, crate::Error> {
|
||||
self.ok_or(crate::Error::SolutionInvalidIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
use private::__OrInvalidIndex;
|
||||
|
||||
pub mod weights;
|
||||
pub use weights::WeightInfo;
|
||||
@@ -209,19 +223,6 @@ pub use weights::WeightInfo;
|
||||
mod mock;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
// Simple Extension trait to easily convert `None` from index closures to `Err`.
|
||||
//
|
||||
// This is only generated and re-exported for the solution code to use.
|
||||
#[doc(hidden)]
|
||||
pub trait __OrInvalidIndex<T> {
|
||||
fn or_invalid_index(self) -> Result<T, Error>;
|
||||
}
|
||||
|
||||
impl<T> __OrInvalidIndex<T> for Option<T> {
|
||||
fn or_invalid_index(self) -> Result<T, Error> {
|
||||
self.ok_or(Error::SolutionInvalidIndex)
|
||||
}
|
||||
}
|
||||
|
||||
/// The [`IndexAssignment`] type is an intermediate between the assignments list
|
||||
/// ([`&[Assignment<T>]`][Assignment]) and `SolutionOf<T>`.
|
||||
|
||||
Reference in New Issue
Block a user