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
use core::ops::Deref;
use crate::parser::{OperatorBindings, DatumAllocator};
use crate::combiner::{Combiner, OpFn, ApFn};
use crate::Datum;
#[derive(Debug)]
#[allow(missing_copy_implementations)]
pub struct EmptyOperatorBindings;
mod private {
#[derive(Debug)]
pub struct DummyOperativeRef<DA, CE>(DA, CE);
#[derive(Debug)]
pub struct DummyApplicativeRef<DA, CE>(DA, CE);
}
use private::*;
impl<DA, CE> Deref for DummyOperativeRef<DA, CE>
where DA: DatumAllocator,
{
type Target = OpFn<DA, CE>;
fn deref(&self) -> &Self::Target { unreachable!() }
}
impl<DA, CE> Deref for DummyApplicativeRef<DA, CE>
where DA: DatumAllocator,
{
type Target = ApFn<DA, CE>;
fn deref(&self) -> &Self::Target { unreachable!() }
}
impl<DA> OperatorBindings<DA> for EmptyOperatorBindings
where DA: DatumAllocator,
{
type OR = DummyOperativeRef<DA, Self::CE>;
type AR = DummyApplicativeRef<DA, Self::CE>;
type CE = ();
#[inline]
fn lookup(&self, _operator: &Datum<DA::TT, DA::ET, DA::DR>)
-> Option<&Combiner<Self::OR, Self::AR>> {
None
}
}