orx_linked_list/list/slice/get.rs
1use super::list_slice::ListSlice;
2use crate::variant::ListVariant;
3use orx_selfref_col::{MemoryPolicy, Refs};
4
5impl<V, M> ListSlice<'_, V, M>
6where
7 V: ListVariant,
8 M: MemoryPolicy<V>,
9{
10 /// Returns the number of elements in the list.
11 ///
12 /// # Examples
13 ///
14 /// ```rust
15 /// use orx_linked_list::*;
16 ///
17 /// let mut list = SinglyList::new();
18 ///
19 /// assert!(list.is_empty());
20 ///
21 /// list.push_front('a');
22 /// assert!(!list.is_empty());
23 ///
24 /// _ = list.pop_front();
25 /// assert!(list.is_empty());
26 /// ```
27 #[inline(always)]
28 pub fn is_empty(&self) -> bool where {
29 !self.ends.is_empty()
30 }
31}