Skip to content
Snippets Groups Projects
Commit 2d5fc451 authored by Glenn Hope's avatar Glenn Hope
Browse files

Create macros for defining Copy and Clone on psp's enums and parenthetical structs

Fix styling

Re-run CI
parent f1fdb962
No related branches found
No related tags found
No related merge requests found
......@@ -121,6 +121,36 @@ macro_rules! s_no_extra_traits {
);
}
#[allow(unused_macros)]
macro_rules! e {
($($(#[$attr:meta])* pub enum $i:ident { $($field:tt)* })*) => ($(
__item! {
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
$(#[$attr])*
pub enum $i { $($field)* }
}
impl ::Copy for $i {}
impl ::Clone for $i {
fn clone(&self) -> $i { *self }
}
)*);
}
#[allow(unused_macros)]
macro_rules! s_paren {
($($(#[$attr:meta])* pub struct $i:ident ( $($field:tt)* ); )* ) => ($(
__item! {
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
$(#[$attr])*
pub struct $i ( $($field)* );
}
impl ::Copy for $i {}
impl ::Clone for $i {
fn clone(&self) -> $i { *self }
}
)*);
}
// This is a pretty horrible hack to allow us to conditionally mark
// some functions as 'const', without requiring users of this macro
// to care about the "const-extern-fn" feature.
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment