Struct alloc::collections::linked_list::Cursor[−][src]

pub struct Cursor<'a, T: 'a> { /* fields omitted */ }
🔬 This is a nightly-only experimental API. (linked_list_cursors #58533)
Expand description

LinkedList 上的游标。

Cursor 类似于迭代器,不同之处在于它可以自由地来回查找。

游标始终位于列表中的两个元素之间,并以逻辑循环的方式进行索引。 为了适应这一点,有一个 “ghost” 非元素在列表的开头和结尾之间产生 None。

创建后,游标从列表的开头开始,如果列表为空,则从 “ghost” 非元素开始。

Implementations

🔬 This is a nightly-only experimental API. (linked_list_cursors #58533)

返回 LinkedList 中的游标位置索引。

如果游标当前指向 “ghost” 非元素,则返回 None。

🔬 This is a nightly-only experimental API. (linked_list_cursors #58533)

将游标移动到 LinkedList 的下一个元素。

如果游标指向 “ghost” 非元素,那么它将移动到 LinkedList 的第一个元素。 如果它指向 LinkedList 的最后一个元素,那么它将把它移到 “ghost” 非元素。

🔬 This is a nightly-only experimental API. (linked_list_cursors #58533)

将游标移动到 LinkedList 的上一个元素。

如果游标指向 “ghost” 非元素,那么它将移动到 LinkedList 的最后一个元素。 如果它指向 LinkedList 的第一个元素,那么它将把它移到 “ghost” 非元素。

🔬 This is a nightly-only experimental API. (linked_list_cursors #58533)

返回对游标当前指向的元素的引用。

如果游标当前指向 “ghost” 非元素,则返回 None。

🔬 This is a nightly-only experimental API. (linked_list_cursors #58533)

返回下一个元素的引用。

如果游标指向 “ghost” 非元素,则返回 LinkedList 的第一个元素。 如果它指向 LinkedList 的最后一个元素,则返回 None。

🔬 This is a nightly-only experimental API. (linked_list_cursors #58533)

返回上一个元素的引用。

如果游标指向 “ghost” 非元素,则返回 LinkedList 的最后一个元素。 如果它指向 LinkedList 的第一个元素,则返回 None。

🔬 This is a nightly-only experimental API. (linked_list_cursors #58533)

提供对游标父列表前元素的引用,如果列表为空,则为 None。

🔬 This is a nightly-only experimental API. (linked_list_cursors #58533)

提供对游标父列表的后部元素的引用,如果列表为空,则为 None。

Trait Implementations

返回值的副本。 Read more

从 source 执行复制分配。 Read more

使用给定的格式化程序格式化该值。 Read more

Auto Trait Implementations

Blanket Implementations

获取 self 的 TypeId。 Read more

从拥有的值中一成不变地借用。 Read more

从拥有的值中借用。 Read more

执行转换。

执行转换。

获得所有权后的结果类型。

通常通过克隆从借用数据中创建拥有的数据。 Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into #41263)

recently added

使用借来的数据来替换拥有的数据,通常是通过克隆。 Read more

发生转换错误时返回的类型。

执行转换。

发生转换错误时返回的类型。

执行转换。