#[doc(hidden)]
#[macro_export]
macro_rules! __rewrite_self_arg {
{
($($args:tt)*)
($out_macro:path)
$($macro_args:tt)*
} => {
$crate::__rewrite_self_arg_inner! {
($($args)*)
($($args)*)
($out_macro)
$($macro_args)*
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __rewrite_self_arg_inner {
{
(&self $($__args_rest:tt)*)
(&$self:ident $(, $($args_rest:tt)*)?)
($out_macro:path)
$($macro_args:tt)*
} => {
$out_macro! {
$($macro_args)*
(add_method)
($self)
(&Self)
(
&$self,
_: $crate::runtime::Sel,
)
($($($args_rest)*)?)
}
};
{
(&mut self $($__args_rest:tt)*)
(&mut $self:ident $(, $($args_rest:tt)*)?)
($out_macro:path)
$($macro_args:tt)*
} => {
$out_macro! {
$($macro_args)*
(add_method)
($self)
(&mut Self)
(
&mut $self,
_: $crate::runtime::Sel,
)
($($($args_rest)*)?)
}
};
{
(self: $__self_ty:ty $(, $($__args_rest:tt)*)?)
($self:ident: $self_ty:ty $(, $($args_rest:tt)*)?)
($out_macro:path)
$($macro_args:tt)*
} => {
$out_macro! {
$($macro_args)*
(add_method)
($self)
($self_ty)
(
$self: $self_ty,
_: $crate::runtime::Sel,
)
($($($args_rest)*)?)
}
};
{
(mut self: $__self_ty:ty $(, $($__args_rest:tt)*)?)
($mut:ident $self:ident: $self_ty:ty $(, $($args_rest:tt)*)?)
($out_macro:path)
$($macro_args:tt)*
} => {
$out_macro! {
$($macro_args)*
(add_method)
($self)
($self_ty)
(
$mut $self: $self_ty,
_: $crate::runtime::Sel,
)
($($($args_rest)*)?)
}
};
{
(mut this: $__self_ty:ty $(, $($__args_rest:tt)*)?)
($mut:ident $this:ident: $this_ty:ty $(, $($args_rest:tt)*)?)
($out_macro:path)
$($macro_args:tt)*
} => {
$out_macro! {
$($macro_args)*
(add_method)
($this)
($this_ty)
(
$mut $this: $this_ty,
_: $crate::runtime::Sel,
)
($($($args_rest)*)?)
}
};
{
(this: $__self_ty:ty $(, $($__args_rest:tt)*)?)
($this:ident: $this_ty:ty $(, $($args_rest:tt)*)?)
($out_macro:path)
$($macro_args:tt)*
} => {
$out_macro! {
$($macro_args)*
(add_method)
($this)
($this_ty)
(
$this: $this_ty,
_: $crate::runtime::Sel,
)
($($($args_rest)*)?)
}
};
{
(mut _this: $__self_ty:ty $(, $($__args_rest:tt)*)?)
($mut:ident $this:ident: $this_ty:ty $(, $($args_rest:tt)*)?)
($out_macro:path)
$($macro_args:tt)*
} => {
$out_macro! {
$($macro_args)*
(add_method)
($this)
($this_ty)
(
$mut $this: $this_ty,
_: $crate::runtime::Sel,
)
($($($args_rest)*)?)
}
};
{
(_this: $__self_ty:ty $(, $($__args_rest:tt)*)?)
($this:ident: $this_ty:ty $(, $($args_rest:tt)*)?)
($out_macro:path)
$($macro_args:tt)*
} => {
$out_macro! {
$($macro_args)*
(add_method)
($this)
($this_ty)
(
$this: $this_ty,
_: $crate::runtime::Sel,
)
($($($args_rest)*)?)
}
};
{
($($__args:tt)*)
($($args_rest:tt)*)
($out_macro:path)
$($macro_args:tt)*
} => {
$out_macro! {
$($macro_args)*
(add_class_method)
(<Self as $crate::ClassType>::class())
(&$crate::runtime::AnyClass)
(
_: &$crate::runtime::AnyClass,
_: $crate::runtime::Sel,
)
($($args_rest)*)
}
};
}