dtolnay / request-for-implementation

Crates that don't exist, but should
610 stars 6 forks source link

a procedural macro for creating extension traits #43

Closed nikomatsakis closed 4 years ago

nikomatsakis commented 4 years ago

I would like a macro where

#[private_extension(Foo)]
impl SomeExternalType {
    fn method(&self) { ... }
}

would expand to

trait Foo {
    fn method(&self);
}

impl Foo for SomeExternalType { ..  }
taiki-e commented 4 years ago

I think easy-ext is the crate for this.

dtolnay commented 4 years ago

Yep, that looks like it. Thanks! https://crates.io/crates/extend is another implementation.