Skip to content

Difference with other "delegate" crates. #13

Pinned Answered by bragov4ik
bragov4ik asked this question in Q&A
Discussion options

You must be logged in to vote

I discovered one use case this crate excels at. Apparently, other crates cannot elegantly delegate associated methods to some other type. For example, the following trait delegate implementations benefit from portrait:

trait SomeTrait {
    fn foo() -> i32;
    fn baz();
}

So, portrait can solve such use case easily:

struct BaseCase;

impl SomeTrait for BaseCase {
    fn foo() -> i32 { 123 }
    fn baz() {
        println!("Hello, World!");
    }
}

struct Wrapper<T: Some…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by SOF3
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants