Skip to content

Commit

Permalink
fix macros
Browse files Browse the repository at this point in the history
  • Loading branch information
rsk0315 committed Feb 10, 2024
1 parent 5fa4c27 commit 72d501a
Showing 1 changed file with 5 additions and 29 deletions.
34 changes: 5 additions & 29 deletions nekolib-src/ops/monoid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,6 @@ impl<T: BinaryOp + Associative + Identity + Recip + Commutative>
{
}

// macro_rules! def_monoid {
// ( $ident:ident = ($ty:ty, $op:expr, $id:expr $(, $marker:ident)* ) ) => {
// pub struct $ident;
// impl BinaryOp for $ident {
// type Set = $ty;
// fn op(&self, lhs: &Self::Set, rhs: &Self::Set) -> Self::Set {
// ($op)(lhs, rhs)
// }
// }
// impl Identity for $ident {
// fn id(&self) -> Self::Set { ($id)() }
// }
// $( impl $marker for $ident {} )*
// };
// ( $ident:ident<$($g:ident : $($b:tt),*),*> = ($ty:ty, $op:expr, $id:expr) ) => {
// pub struct $ident<$($g),*>;
// impl<$($g:$($b)*),*> BinaryOp for $ident<$($g),*> {
// type Set = $ty;
// fn op(&self, lhs: &Self::Set, rhs: &Self::Set) -> Self::Set {
// ($op)(lhs, rhs)
// }
// }
// impl<$($g:$($b)*),*> Identity for $ident<$($g),*> {
// fn id(&self) -> Self::Set { ($id)() }
// }
// // $( impl<$($g:$($b),*),*> $marker for $ident<$($g),*> {} )*
// };
// }

#[macro_export]
macro_rules! def_monoid_generics {
(
Expand Down Expand Up @@ -99,6 +70,11 @@ macro_rules! def_monoid_generics {
impl<$($gen)*> $crate::Associative for $name<$($gen)*>
where $($where)*
{}
impl<$($gen)*> Default for $name<$($gen)*>
where $($where)*
{
fn default() -> Self { Self::new() }
}
};
(
$name:ident[$($gen:tt)*] where [$($where:tt)*] =
Expand Down

0 comments on commit 72d501a

Please sign in to comment.