What do I need to put into the where clause for the generic NumT
so that I can subtract references to NumT
?
I'm currently getting the following error:
cannot subtract `&NumT` from `&NumT`
What do I need to put into the where clause for the generic NumT
so that I can subtract references to NumT
?
I'm currently getting the following error:
cannot subtract `&NumT` from `&NumT`
note that both are immutable references.
NumT: SubAssign<&NumT>
should work, if you have a &mut NumT
No, these are both immutable references. I don't want to trash any of their values, instead I just want to create a new value.
yep. Rust Playground
Got there in the end:
&'t NumT: Sub<Output = NumT>
does the trick
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.