[−][src]Trait kul_core::parser::DatumAllocator
Allocator of space for Datum
values that a Parser
constructs.
Enables the parsing logic to be generic over this aspect so that various approaches may be chosen depending on the application. E.g. heap vs. stack allocation.
Associated Types
type TT: Text
The Text
type for our Datum
type. It should also implement
TextConcat<Self>
so it supports concatenation which the parsing
requires.
Such a bound is not required here, to avoid difficulties that otherwise
would happen with needing to have the bound where not really needed and
where unresolvable mutually-recursive bounds would result. The bound is
instead placed on the methods of ParseIter
and SourceStream
implementations where it's really needed.
type ET
The "extra" type for our Datum
type.
type DR: DerefTryMut<Target = Datum<Self::TT, Self::ET, Self::DR>>
The type of references to Datum
s yielded by our
parsing.
Required methods
fn new_datum(
&mut self,
from: Datum<Self::TT, Self::ET, Self::DR>
) -> Result<Self::DR, AllocError>
&mut self,
from: Datum<Self::TT, Self::ET, Self::DR>
) -> Result<Self::DR, AllocError>
Allocate a fresh Datum
, in whatever way the
particular implementation wants, and set its initial value to that of
the from
argument. An AllocError
is
returned if allocation fails for any reason.
Implementors
impl<'a, TT, ET> DatumAllocator for SliceDatumAllocator<'a, TT, ET> where
TT: Text,
[src]
TT: Text,
type TT = TT
type ET = ET
type DR = DatumMutRef<'a, Self::TT, Self::ET>
fn new_datum(
&mut self,
from: MutRefDatum<'a, Self::TT, Self::ET>
) -> Result<Self::DR, AllocError>
[src]
&mut self,
from: MutRefDatum<'a, Self::TT, Self::ET>
) -> Result<Self::DR, AllocError>