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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
mod inserted;
mod inserted_or_modified;
mod modified;

use super::AbstractMut;
use crate::component::Component;
use crate::entity_id::EntityId;
use crate::not::Not;
use crate::sparse_set::{FullRawWindow, FullRawWindowMut};

impl<'w, T: Component> AbstractMut for Not<FullRawWindow<'w, T, T::Tracking>> {
    type Out = ();
    type Index = usize;

    #[inline]
    unsafe fn get_data(&self, _: usize) -> Self::Out {}
    #[inline]
    unsafe fn get_datas(&self, _: Self::Index) -> Self::Out {}
    #[inline]
    fn indices_of(&self, entity: EntityId, _: usize, _: u16) -> Option<Self::Index> {
        if self.0.index_of(entity).is_some() {
            None
        } else {
            Some(core::usize::MAX)
        }
    }
    #[inline]
    unsafe fn indices_of_unchecked(&self, _: EntityId, _: usize, _: u16) -> Self::Index {
        unreachable!()
    }
    #[inline]
    unsafe fn get_id(&self, _: usize) -> EntityId {
        unreachable!()
    }
    #[inline]
    fn len(&self) -> usize {
        self.0.len()
    }
}

impl<'w, T: Component> AbstractMut for Not<FullRawWindowMut<'w, T, T::Tracking>> {
    type Out = ();
    type Index = usize;

    #[inline]
    unsafe fn get_data(&self, _: usize) -> Self::Out {}
    #[inline]
    unsafe fn get_datas(&self, _: Self::Index) -> Self::Out {}
    #[inline]
    fn indices_of(&self, entity: EntityId, _: usize, _: u16) -> Option<Self::Index> {
        if self.0.index_of(entity).is_some() {
            None
        } else {
            Some(core::usize::MAX)
        }
    }
    #[inline]
    unsafe fn indices_of_unchecked(&self, _: EntityId, _: usize, _: u16) -> Self::Index {
        unreachable!()
    }
    #[inline]
    unsafe fn get_id(&self, _: usize) -> EntityId {
        unreachable!()
    }
    #[inline]
    fn len(&self) -> usize {
        self.0.dense_len
    }
}