autocommit 2022-02-02 20:01:25 CET
This commit is contained in:
parent
65a7a55b82
commit
89b8396932
12 changed files with 279 additions and 57 deletions
|
|
@ -196,6 +196,29 @@ impl<T> NodeRef<T> {
|
|||
pub fn append(&self, t: T) -> LinkedNode<T> {
|
||||
unsafe { append(self.data, t) }
|
||||
}
|
||||
|
||||
pub fn prev(&self) -> NodeRef<T> {
|
||||
unsafe {
|
||||
let data = self.data.as_ref();
|
||||
let other = data.prev.get();
|
||||
other.as_ref().rc.fetch_add(1);
|
||||
NodeRef {
|
||||
data: other,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn next(&self) -> NodeRef<T> {
|
||||
unsafe {
|
||||
let data = self.data.as_ref();
|
||||
let other = data.next.get();
|
||||
other.as_ref().rc.fetch_add(1);
|
||||
NodeRef {
|
||||
data: other,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct NodeData<T> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue