1 个不稳定版本
0.2.0 | 2020年3月10日 |
---|---|
0.1.0 |
|
#2191 in 数据结构
每月 22 下载
43KB
655 行
rust-arae
诅咒数据结构
文档托管在 docs.rs。
arae = "0.2.0"
示例
use arae::{CurVec, CursedExt, Bounded};
// Create a new `CurVec` of length 10 with the elements
// initialized via `Default::default`.
let mut vec = CurVec::new_with_default(10);
// Create two cursors pointing the the head of the vec.
let write_cursor = vec.head();
let read_cursor = vec.head();
*vec.get_mut(write_cursor) = 1;
assert_eq!(*vec.get(read_cursor), 1);
lib.rs
:
arae
提供了 Cursed
,这是一个为类型提供通过 Cursor
访问其元素的能力的 trait。
示例
use arae::{CurVec, CursedExt, Bounded};
// Create a new `CurVec` of length 10 with the elements
// initialized via `Default::default`.
let mut vec = CurVec::new_with_default(10);
// Create two cursors pointing the the head of the vec.
let write_cursor = vec.head();
let read_cursor = vec.head();
*vec.get_mut(write_cursor) = 1;
assert_eq!(*vec.get(read_cursor), 1);
依赖关系
~0–270KB