1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use super::list_slice::ListSlice;
use crate::variant::ListVariant;
use orx_selfref_col::{MemoryPolicy, Refs};

impl<'a, V, M> ListSlice<'a, V, M>
where
    V: ListVariant,
    M: MemoryPolicy<V>,
{
    /// Returns the number of elements in the list.
    ///
    /// # Examples
    ///
    /// ```rust
    /// use orx_linked_list::*;
    ///
    /// let mut list = SinglyList::new();
    ///
    /// assert!(list.is_empty());
    ///
    /// list.push_front('a');
    /// assert!(!list.is_empty());
    ///
    /// _ = list.pop_front();
    /// assert!(list.is_empty());
    /// ```
    #[inline(always)]
    pub fn is_empty(&self) -> bool where {
        !self.ends.is_empty()
    }
}