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
use necsim_core::{
    cogs::{Backup, ImmigrationEntry, MathsCore},
    lineage::MigratingLineage,
};

#[allow(clippy::module_name_repetitions)]
#[derive(Debug, Default)]
#[cfg_attr(feature = "cuda", derive(rust_cuda::lend::LendRustToCuda))]
pub struct NeverImmigrationEntry([u8; 0]);

#[contract_trait]
impl Backup for NeverImmigrationEntry {
    unsafe fn backup_unchecked(&self) -> Self {
        Self([])
    }
}

#[contract_trait]
impl<M: MathsCore> ImmigrationEntry<M> for NeverImmigrationEntry {
    #[must_use]
    #[inline]
    #[debug_ensures(ret.is_none(), "no lineage ever immigrates")]
    fn next_optional_immigration(&mut self) -> Option<MigratingLineage> {
        None
    }

    #[must_use]
    #[inline]
    #[debug_ensures(ret.is_none(), "no lineage ever immigrates")]
    fn peek_next_immigration(&self) -> Option<&MigratingLineage> {
        None
    }
}