How to implement a trait for any mutability?

你离开我真会死。 提交于 2019-12-05 07:06:48

Can mutability be a generic parameter in traits?

No. ^_^

Here's some detailed discussion on the matter (Internals, Reddit).

I think in general people recognize that the current state is not ideal, but that it's not terribly constraining at the moment, either. There's concerns on exactly how it would be implemented and the soundness of various approaches. Some people wonder if Higher-Kinded Types (HKTs) would solve the problem, if and when they are added to Rust.

See also:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!