mirror of
https://github.com/Dummi26/musicdb.git
synced 2025-03-10 05:43:53 +01:00
fix Move impl
This commit is contained in:
parent
a2d24e780a
commit
81ec0d6668
@ -467,21 +467,8 @@ impl QueueFolder {
|
|||||||
if from == to {
|
if from == to {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
unsafe {
|
let elem = vec.remove(from);
|
||||||
if from < to {
|
vec.insert(to, elem);
|
||||||
let elem = vec.as_mut_ptr().add(from).read();
|
|
||||||
for i in from..to {
|
|
||||||
vec[i] = vec.as_mut_ptr().add(i + 1).read();
|
|
||||||
}
|
|
||||||
vec[to] = elem;
|
|
||||||
} else {
|
|
||||||
let elem = vec.as_mut_ptr().add(from).read();
|
|
||||||
for i in (to..from).rev() {
|
|
||||||
vec[i + 1] = vec.as_mut_ptr().add(i).read();
|
|
||||||
}
|
|
||||||
vec[to] = elem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
Loading…
Reference in New Issue
Block a user