Skip to content

Commit 9b5e2e8

Browse files
authored
Merge pull request #37 from orxfun/upgrade-selfref-col-dependency-to-v2.3
Upgrade selfref col dependency to v2.3
2 parents 4a7d0f5 + 694c82c commit 9b5e2e8

28 files changed

+257
-240
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "orx-linked-list"
3-
version = "3.2.0"
3+
version = "3.3.0"
44
edition = "2021"
55
authors = ["orxfun <[email protected]>"]
66
description = "A linked list implementation with unique features and an extended list of constant time methods providing high performance traversals and mutations."
@@ -14,10 +14,10 @@ orx-pseudo-default = { version = "1.4", default-features = false }
1414
orx-pinned-vec = "3.11"
1515
orx-split-vec = "3.11"
1616
orx-fixed-vec = "3.11"
17-
orx-selfref-col = "2.2"
17+
orx-selfref-col = "2.3"
1818

1919
[dev-dependencies]
20-
clap = { version = "4.5.17", features = ["derive"] }
20+
clap = { version = "4.5.27", features = ["derive"] }
2121
criterion = "0.5"
2222
rand = "0.8.5"
2323
rand_chacha = "0.3.1"

src/iter/doubly_iter_mut.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ where
5555
fn next(&mut self) -> Option<Self::Item> {
5656
match &self.current {
5757
Some(p) => {
58-
let ptr = p.ptr();
58+
let ptr = p.ptr_mut();
5959
match self.current == self.current_back {
60-
false => self.current = self.col.node(p).next().get(),
60+
false => self.current = self.col.node(p).next().get().cloned(),
6161
true => self.end(),
6262
}
6363

@@ -75,9 +75,9 @@ where
7575
fn next_back(&mut self) -> Option<Self::Item> {
7676
match &self.current_back {
7777
Some(p) => {
78-
let ptr = p.ptr();
78+
let ptr = p.ptr_mut();
7979
match self.current == self.current_back {
80-
false => self.current_back = self.col.node(p).prev().get(),
80+
false => self.current_back = self.col.node(p).prev().get().cloned(),
8181
true => self.end(),
8282
}
8383
unsafe { &mut *ptr }.data_mut()

src/iter/doubly_iter_owned.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ where
2020
P: PinnedVec<Node<Doubly<T>>>,
2121
{
2222
pub(crate) fn new(col: CoreCol<Doubly<T>, P>) -> Self {
23-
let current = col.ends().get(0);
24-
let current_back = col.ends().get(1);
23+
let current = col.ends().get(0).cloned();
24+
let current_back = col.ends().get(1).cloned();
2525
Self {
2626
col,
2727
current,
@@ -44,9 +44,9 @@ where
4444
fn next(&mut self) -> Option<Self::Item> {
4545
match &self.current {
4646
Some(p) => {
47-
let ptr = p.ptr();
47+
let ptr = p.ptr_mut();
4848
match self.current == self.current_back {
49-
false => self.current = self.col.node(p).next().get(),
49+
false => self.current = self.col.node(p).next().get().cloned(),
5050
true => self.end(),
5151
}
5252

@@ -64,9 +64,9 @@ where
6464
fn next_back(&mut self) -> Option<Self::Item> {
6565
match &self.current_back {
6666
Some(p) => {
67-
let ptr = p.ptr();
67+
let ptr = p.ptr_mut();
6868
match self.current == self.current_back {
69-
false => self.current_back = self.col.node(p).prev().get(),
69+
false => self.current_back = self.col.node(p).prev().get().cloned(),
7070
true => self.end(),
7171
}
7272

src/iter/doubly_iter_ptr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ where
4848
Some(p) => {
4949
let ptr = Some(p.clone());
5050
match self.current == self.current_back {
51-
false => self.current = self.col.node(p).next().get(),
51+
false => self.current = self.col.node(p).next().get().cloned(),
5252
true => self.end(),
5353
}
5454

@@ -69,7 +69,7 @@ where
6969
let ptr = Some(p.clone());
7070

7171
match self.current == self.current_back {
72-
false => self.current_back = self.col.node(p).prev().get(),
72+
false => self.current_back = self.col.node(p).prev().get().cloned(),
7373
true => self.end(),
7474
}
7575

src/iter/doubly_link_iter_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ where
5252
match Some(&curr) == self.current_back.as_ref() {
5353
false => {
5454
//
55-
let next = self.col.node(&curr).next().get();
55+
let next = self.col.node(&curr).next().get().cloned();
5656
let new_current = next.map(|next| (curr.clone(), next));
5757
self.current = new_current;
5858
}

src/iter/singly_iter_mut.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ where
1919
P: PinnedVec<Node<Singly<T>>>,
2020
{
2121
pub(crate) fn new_old(col: &'a mut CoreCol<Singly<T>, P>) -> Self {
22-
let current = col.ends().get();
22+
let current = col.ends().get().cloned();
2323
Self { col, current }
2424
}
2525

@@ -40,8 +40,8 @@ where
4040
fn next(&mut self) -> Option<Self::Item> {
4141
match &self.current {
4242
Some(p) => {
43-
let ptr = p.ptr();
44-
self.current = self.col.node(p).next().get();
43+
let ptr = p.ptr_mut();
44+
self.current = self.col.node(p).next().get().cloned();
4545
unsafe { &mut *ptr }.data_mut()
4646
}
4747
None => None,

src/iter/singly_iter_owned.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ where
1919
P: PinnedVec<Node<Singly<T>>>,
2020
{
2121
pub(crate) fn new(col: CoreCol<Singly<T>, P>) -> Self {
22-
let current = col.ends().get();
22+
let current = col.ends().get().cloned();
2323
Self { col, current }
2424
}
2525
}
@@ -33,8 +33,8 @@ where
3333
fn next(&mut self) -> Option<Self::Item> {
3434
match &self.current {
3535
Some(p) => {
36-
let ptr = p.ptr();
37-
self.current = self.col.node(p).next().get();
36+
let ptr = p.ptr_mut();
37+
self.current = self.col.node(p).next().get().cloned();
3838
unsafe { &mut *ptr }.take_data()
3939
}
4040
None => None,

src/iter/singly_iter_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ where
3333
match &self.current {
3434
Some(p) => {
3535
let ptr = Some(p.clone());
36-
self.current = self.col.node(p).next().get();
36+
self.current = self.col.node(p).next().get().cloned();
3737
ptr
3838
}
3939
None => None,

src/list/ends_traits/doubly_ends.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ where
3939
{
4040
self.ends()
4141
.get(FRONT_IDX)
42-
.map(|p| unsafe { self.col().data_unchecked(&p) })
42+
.map(|p| unsafe { self.col().data_unchecked(p) })
4343
}
4444

4545
/// ***O(1)*** Returns a reference to the back of the list.
@@ -72,7 +72,7 @@ where
7272
{
7373
self.ends()
7474
.get(BACK_IDX)
75-
.map(|p| unsafe { self.col().data_unchecked(&p) })
75+
.map(|p| unsafe { self.col().data_unchecked(p) })
7676
}
7777

7878
// idx
@@ -529,7 +529,7 @@ where
529529
fn next_idx_of(&self, idx: &DoublyIdx<T>) -> Option<DoublyIdx<T>> {
530530
let ptr = self.col().try_get_ptr(idx).expect(IDX_ERR);
531531
let next_ptr = self.col().node(&ptr).next().get();
532-
next_ptr.map(|p| DoublyIdx::new(self.col().memory_state(), &p))
532+
next_ptr.map(|p| DoublyIdx::new(self.col().memory_state(), p))
533533
}
534534

535535
/// ***O(1)*** Returns the element succeeding the one with the given `idx`.
@@ -596,7 +596,7 @@ where
596596
fn prev_idx_of(&self, idx: &DoublyIdx<T>) -> Option<DoublyIdx<T>> {
597597
let ptr = self.col().try_get_ptr(idx).expect(IDX_ERR);
598598
let prev_ptr = self.col().node(&ptr).prev().get();
599-
prev_ptr.map(|p| DoublyIdx::new(self.col().memory_state(), &p))
599+
prev_ptr.map(|p| DoublyIdx::new(self.col().memory_state(), p))
600600
}
601601

602602
/// ***O(1)*** Returns the element preceding the one with the given `idx`.

0 commit comments

Comments
 (0)