This commit is contained in:
nora 2022-03-22 09:54:44 +01:00
parent 2d3b5f3c94
commit 25ac075ef1
3 changed files with 75 additions and 1 deletions

18
src/linked_list.rs Normal file
View file

@ -0,0 +1,18 @@
use std::ptr;
use std::sync::atomic::AtomicPtr;
pub struct LinkedList<T> {
head: AtomicPtr<Node<T>>,
}
struct Node<T> {
next: AtomicPtr<Node<T>>,
}
impl<T> LinkedList<T> {
pub fn new() -> Self {
Self {
head: AtomicPtr::new(ptr::null_mut()),
}
}
}