Macro core::marker::marker_impls
source · macro marker_impls { ( $(#[$($meta:tt)*])* $Trait:ident for $({$($bounds:tt)*})? $T:ty $(, $($rest:tt)*)? ) => { ... }, ( $(#[$($meta:tt)*])* $Trait:ident for ) => { ... }, ( $(#[$($meta:tt)*])* unsafe $Trait:ident for $({$($bounds:tt)*})? $T:ty $(, $($rest:tt)*)? ) => { ... }, ( $(#[$($meta:tt)*])* unsafe $Trait:ident for ) => { ... }, }
🔬This is a nightly-only experimental API. (
internal_impls_macro
)Expand description
Implements a given marker trait for multiple types at the same time.
The basic syntax looks like this:
You can also implement unsafe
traits
Add attributes to all impls:
ⓘ
marker_impls! {
#[allow(lint)]
#[unstable(feature = "marker_trait", issue = "none")]
MarkerTrait for u8, i8
}
RunAnd use generics: