mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 09:57:56 +00:00
Allow multiple bounds to be specified at decl_error! (#7448)
* Allow multiple bounds to be specified at decl_error! Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Test if decl_error! accepts multiple bounds Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
9687759774
commit
9bfaf451a7
@@ -77,7 +77,7 @@ macro_rules! decl_error {
|
||||
$generic:ident: $trait:path
|
||||
$(, $inst_generic:ident: $instance:path)?
|
||||
>
|
||||
$( where $( $where_ty:ty: $where_bound:path )* $(,)? )?
|
||||
$( where $( $where_ty:ty: $where_bound:path ),* $(,)? )?
|
||||
{
|
||||
$(
|
||||
$( #[doc = $doc_attr:tt] )*
|
||||
@@ -88,7 +88,7 @@ macro_rules! decl_error {
|
||||
) => {
|
||||
$(#[$attr])*
|
||||
pub enum $error<$generic: $trait $(, $inst_generic: $instance)?>
|
||||
$( where $( $where_ty: $where_bound )* )?
|
||||
$( where $( $where_ty: $where_bound ),* )?
|
||||
{
|
||||
#[doc(hidden)]
|
||||
__Ignore(
|
||||
@@ -103,7 +103,7 @@ macro_rules! decl_error {
|
||||
|
||||
impl<$generic: $trait $(, $inst_generic: $instance)?> $crate::sp_std::fmt::Debug
|
||||
for $error<$generic $(, $inst_generic)?>
|
||||
$( where $( $where_ty: $where_bound )* )?
|
||||
$( where $( $where_ty: $where_bound ),* )?
|
||||
{
|
||||
fn fmt(&self, f: &mut $crate::sp_std::fmt::Formatter<'_>) -> $crate::sp_std::fmt::Result {
|
||||
f.write_str(self.as_str())
|
||||
@@ -111,7 +111,7 @@ macro_rules! decl_error {
|
||||
}
|
||||
|
||||
impl<$generic: $trait $(, $inst_generic: $instance)?> $error<$generic $(, $inst_generic)?>
|
||||
$( where $( $where_ty: $where_bound )* )?
|
||||
$( where $( $where_ty: $where_bound ),* )?
|
||||
{
|
||||
fn as_u8(&self) -> u8 {
|
||||
$crate::decl_error! {
|
||||
@@ -136,7 +136,7 @@ macro_rules! decl_error {
|
||||
|
||||
impl<$generic: $trait $(, $inst_generic: $instance)?> From<$error<$generic $(, $inst_generic)?>>
|
||||
for &'static str
|
||||
$( where $( $where_ty: $where_bound )* )?
|
||||
$( where $( $where_ty: $where_bound ),* )?
|
||||
{
|
||||
fn from(err: $error<$generic $(, $inst_generic)?>) -> &'static str {
|
||||
err.as_str()
|
||||
@@ -145,7 +145,7 @@ macro_rules! decl_error {
|
||||
|
||||
impl<$generic: $trait $(, $inst_generic: $instance)?> From<$error<$generic $(, $inst_generic)?>>
|
||||
for $crate::sp_runtime::DispatchError
|
||||
$( where $( $where_ty: $where_bound )* )?
|
||||
$( where $( $where_ty: $where_bound ),* )?
|
||||
{
|
||||
fn from(err: $error<$generic $(, $inst_generic)?>) -> Self {
|
||||
let index = <$generic::PalletInfo as $crate::traits::PalletInfo>
|
||||
@@ -162,7 +162,7 @@ macro_rules! decl_error {
|
||||
|
||||
impl<$generic: $trait $(, $inst_generic: $instance)?> $crate::error::ModuleErrorMetadata
|
||||
for $error<$generic $(, $inst_generic)?>
|
||||
$( where $( $where_ty: $where_bound )* )?
|
||||
$( where $( $where_ty: $where_bound ),* )?
|
||||
{
|
||||
fn metadata() -> &'static [$crate::error::ErrorMetadata] {
|
||||
&[
|
||||
|
||||
Reference in New Issue
Block a user