Skip to content

Using traits from external third-party libraries #2590

Answered by fzyzcjy
akkumar asked this question in Q&A
Discussion options

You must be logged in to vote

I will check whether it's a bug later. But a quick workaround is: Write pub type ThirdPartyCalc(Box<dyn Calc>); and define methods (which is only one-liners because it does nothing but forward everything to the external type) on the new type.

Replies: 6 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@fzyzcjy
Comment options

@akkumar
Comment options

Comment options

You must be logged in to vote
3 replies
@fzyzcjy
Comment options

Answer selected by akkumar
@akkumar
Comment options

@fzyzcjy
Comment options

Comment options

You must be logged in to vote
1 reply
@fzyzcjy
Comment options

Comment options

You must be logged in to vote
3 replies
@fzyzcjy
Comment options

@akkumar
Comment options

@fzyzcjy
Comment options

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