Get the first element from the list.
(&self, pool: &ListPool<T>)
| 325 | |
| 326 | /// Get the first element from the list. |
| 327 | pub fn first(&self, pool: &ListPool<T>) -> Option<T> { |
| 328 | if self.is_empty() { |
| 329 | None |
| 330 | } else { |
| 331 | Some(pool.data[self.index as usize]) |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | /// Get the list as a mutable slice. |
| 336 | pub fn as_mut_slice<'a>(&'a mut self, pool: &'a mut ListPool<T>) -> &'a mut [T] { |