carbotaniuman / auto_ops

Macros for overloading operators easily in Rust.
MIT License
34 stars 9 forks source link

support for optional #[inline] #12

Closed snaar closed 2 years ago

snaar commented 2 years ago

Would it be possible to support adding #[inline] to the generated fn signatures? I.e. for example have:

#[inline]
fn $ops_fn(self, $rhs_i: $rhs) -> Self::Output {
    let $lhs_i = self;
    $body
}

instead of

fn $ops_fn(self, $rhs_i: $rhs) -> Self::Output {
    let $lhs_i = self;
    $body
}
snaar commented 2 years ago

Arguably, you almost always want operators to be inline, so maybe you can just add inline everywhere without making it optional.

carbotaniuman commented 2 years ago

I'll try and figure out if I can get the macro to accept arbitrary attributes, or else I'll just mark it inline.

carbotaniuman commented 2 years ago

This is being addressed by #13.