mirror of
https://github.com/panpaul/tiny_os
synced 2024-09-20 09:45:19 +08:00
feat: utils/linked_list: add is_empty
This commit is contained in:
parent
9f4a804e30
commit
27fdf26cc1
@ -65,6 +65,12 @@ impl<T: LinkHelper<ID>, const ID: usize> Link<T, ID> {
|
|||||||
&*(container_of_offset!(self, T, T::LINK_OFFSET))
|
&*(container_of_offset!(self, T, T::LINK_OFFSET))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
debug_assert!(!(self.prev.is_none() && self.next.is_some()));
|
||||||
|
debug_assert!(!(self.prev.is_some() && self.next.is_none()));
|
||||||
|
self.prev.is_none() && self.next.is_none()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn prev_raw(&self) -> &Option<AtomicPtr<T>> {
|
pub fn prev_raw(&self) -> &Option<AtomicPtr<T>> {
|
||||||
&self.prev
|
&self.prev
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user