use super::{Entry, EntryHandle, RegistrationQueueEntry};
use crate::util::linked_list;
type EntryList = linked_list::LinkedList<RegistrationQueueEntry, Entry>;
#[derive(Debug)]
pub(crate) struct RegistrationQueue {
list: EntryList,
}
impl Drop for RegistrationQueue {
fn drop(&mut self) {
while let Some(hdl) = self.list.pop_front() {
drop(hdl);
}
}
}
impl RegistrationQueue {
pub(crate) fn new() -> Self {
Self {
list: EntryList::new(),
}
}
pub(crate) unsafe fn push_front(&mut self, hdl: EntryHandle) {
self.list.push_front(hdl);
}
pub(crate) fn pop_front(&mut self) -> Option<EntryHandle> {
self.list.pop_front()
}
}
#[cfg(test)]
mod tests;