1#![doc = include_str!("../README.md")]
2
3pub use dris_macros::{component, constructor};
4
5pub struct All<T>(Vec<T>);
7
8impl<T> All<T> {
9 pub fn new(items: Vec<T>) -> Self {
10 Self(items)
11 }
12}
13
14impl<T> std::ops::Deref for All<T> {
15 type Target = [T];
16
17 fn deref(&self) -> &Self::Target {
18 &self.0
19 }
20}
21
22impl<T> IntoIterator for All<T> {
23 type Item = T;
24 type IntoIter = std::vec::IntoIter<T>;
25
26 fn into_iter(self) -> Self::IntoIter {
27 self.0.into_iter()
28 }
29}
30
31impl<'a, T> IntoIterator for &'a All<T> {
32 type Item = &'a T;
33 type IntoIter = std::slice::Iter<'a, T>;
34
35 fn into_iter(self) -> Self::IntoIter {
36 self.0.iter()
37 }
38}
39
40#[derive(Clone, Copy, PartialEq, Eq, Hash)]
41pub struct Type(std::any::TypeId);
42
43impl Type {
44 pub fn of<T: 'static>() -> Self {
45 Self(std::any::TypeId::of::<T>())
46 }
47}