hobofan / ambassador

Delegation of trait implementations via procedural macros
Apache License 2.0
245 stars 13 forks source link

Add new attribute: inhibit_automatic_where_clause #34

Closed vi closed 1 year ago

vi commented 2 years ago

Allows to opt out of where clause, in cases where it gets in the way.

My use case:


#[delegatable_trait]
trait SomeTrait{}

#[derive(ambassador::Delegate)]
#[delegate(SomeTrait,inhibit_automatic_where_clause="true")]
pub struct DynSomeTrait(pub Box<dyn SomeTrait + Send>);

It allows user to request structural typing (like with target="self"), but with other targets instead of self.

If this feature is welcome in ambassador, I can also provide in this pull request:

vi commented 1 year ago

@dewert99, Done.

Some changes:

dewert99 commented 1 year ago

This looks great do you think you could run rustfmt and then I can pull this