use std::marker::PhantomData;
use crate::{
parser::{DatumAllocator, AllocError},
datum::{DatumArc, ArcDatum},
Text,
};
#[derive(Debug)]
pub struct ArcDatumAllocator<TT, ET>(PhantomData<(*const TT, *const ET)>);
impl<TT, ET> Default for ArcDatumAllocator<TT, ET>
where TT: Text,
{
#[inline]
fn default() -> Self {
Self(PhantomData)
}
}
impl<TT, ET> DatumAllocator for ArcDatumAllocator<TT, ET>
where TT: Text,
{
type TT = TT;
type ET = ET;
type DR = DatumArc<Self::TT, Self::ET>;
#[inline]
fn new_datum(&mut self, from: ArcDatum<Self::TT, Self::ET>)
-> Result<Self::DR, AllocError>
{
Ok(DatumArc::new(from))
}
}