1use std::marker::PhantomData;
2
3use crate::{
4 parser::{DatumAllocator, AllocError},
5 datum::{DatumArc, ArcDatum},
6 Text,
7};
8
9
10#[derive(Debug)]
15pub struct ArcDatumAllocator<TT, ET>(PhantomData<(*const TT, *const ET)>);
16
17impl<TT, ET> Default for ArcDatumAllocator<TT, ET>
20 where TT: Text,
21{
22 #[inline]
24 fn default() -> Self {
25 Self(PhantomData)
26 }
27}
28
29impl<TT, ET> DatumAllocator for ArcDatumAllocator<TT, ET>
30 where TT: Text,
31{
32 type TT = TT;
33 type ET = ET;
34 type DR = DatumArc<Self::TT, Self::ET>;
35
36 #[inline]
37 fn new_datum(&mut self, from: ArcDatum<Self::TT, Self::ET>)
38 -> Result<Self::DR, AllocError>
39 {
40 Ok(DatumArc::new(from))
41 }
42}
43
44
45