orx_iterable/obj_safe/sources/
empty.rs

1use crate::{
2    obj_safe::{CollectionMutObj, CollectionObj, IterableObj},
3    sources::{Empty, EmptyCol},
4    Collection, CollectionMut, Iterable,
5};
6use std::boxed::Box;
7
8impl<T> IterableObj for Empty<T> {
9    type Item = T;
10
11    fn boxed_iter(&self) -> Box<dyn Iterator<Item = Self::Item> + '_> {
12        Box::new(self.iter())
13    }
14}
15
16impl<T> IterableObj for core::iter::Empty<T> {
17    type Item = T;
18
19    fn boxed_iter(&self) -> Box<dyn Iterator<Item = Self::Item> + '_> {
20        Box::new(self.iter())
21    }
22}
23
24// col
25
26impl<'a, T> IterableObj for &'a EmptyCol<T> {
27    type Item = &'a T;
28
29    fn boxed_iter(&self) -> Box<dyn Iterator<Item = Self::Item> + '_> {
30        Box::new(self.iter())
31    }
32}
33
34impl<T> CollectionObj for EmptyCol<T> {
35    type Item = T;
36
37    fn boxed_iter(&self) -> Box<dyn Iterator<Item = &Self::Item> + '_> {
38        Box::new(self.iter())
39    }
40}
41
42impl<T> CollectionMutObj for EmptyCol<T> {
43    fn boxed_iter_mut(&mut self) -> Box<dyn Iterator<Item = &mut Self::Item> + '_> {
44        Box::new(self.iter_mut())
45    }
46}