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

Fix styling

Re-run CI
This commit is contained in:
Glenn Hope 2020-07-26 17:35:11 -07:00
parent f1fdb9622c
commit 2d5fc45139
2 changed files with 1338 additions and 1514 deletions

View File

@ -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.

2822
src/psp.rs

File diff suppressed because it is too large Load Diff