Skip to content

Delegate directly from Box<T>, Arc<T>, etc. #68

@musjj

Description

@musjj

Is there a way to delegate traits directly from Box<T>, Arc<T>, etc. without a wrapper? For example, something like the following:

#[delegatable_trait(for = "Box<T>")]
trait Foo {
    fn hello(&self) -> String;
}

Will generate something like this:

trait Foo {
    fn hello(&self) -> String;
}

impl<T: Foo> Foo for Box<T> {
    fn hello(&self) -> String {
        (**self).hello()
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions