Does <'a, 'b: 'a> mean that the lifetime 'b must outlive the lifetime 'a?

戏子无情 提交于 2019-11-28 09:47:53

The colon is read "outlives", so

'long: 'short

is read "'long outlives 'short".

As for an official doc on the topic, the only place I've seen it documented so far is in the RFC on lifetime bounds.

Yes, you're broadly right.

A bound <...: 'a> means that ... (either a type or another lifetime) needs to be able to outlive 'a. E.g. 'b: 'a means that "'b must live at least as long as 'a" (not strictly outlives, though: they can be the same).

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