1
0
Fork 0
forked from wry/wry

autocommit 2022-04-04 00:28:58 CEST

This commit is contained in:
Julian Orth 2022-04-04 00:28:58 +02:00
parent 9ec1c5c995
commit 1f71290dab
21 changed files with 1217 additions and 132 deletions

View file

@ -1,4 +1,4 @@
use crate::utils::ptr_ext::MutPtrExt;
use crate::utils::ptr_ext::{MutPtrExt, PtrExt};
use std::cell::UnsafeCell;
pub struct Stack<T> {
@ -23,4 +23,13 @@ impl<T> Stack<T> {
pub fn pop(&self) -> Option<T> {
unsafe { self.vec.get().deref_mut().pop() }
}
pub fn to_vec(&self) -> Vec<T>
where T: Clone,
{
unsafe {
let v = self.vec.get().deref();
(*v).clone()
}
}
}

View file

@ -3,6 +3,7 @@ use std::cell::UnsafeCell;
use std::collections::VecDeque;
use std::mem;
#[derive(Debug)]
pub struct SyncQueue<T> {
el: UnsafeCell<VecDeque<T>>,
}