traits2.rs Function Equivalence #2354
Unanswered
Savaesthetic
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In the traits2.rs solution, the function signature for append_bar differs between the
traitdefinition and theVec<String>implementation.Why does this compile if the function signatures differ?
My understanding is that because the function is not taking a reference, that the
mutkeyword is stating thatselfis mutable within the function. This seems to offer an additional level of freedom compared to thetraitsignature which states thatselfis NOT mutable.In this case how can these two function be considered equivalent?
Beta Was this translation helpful? Give feedback.
All reactions