[][src]Trait kul_core::TextConcat

pub trait TextConcat<DA>: Text {
    fn concat(
        self,
        other: Self,
        datum_alloc: &mut DA
    ) -> Result<Self, AllocError>; }

A Text that can logically concatenate its values, optionally by using a provided DatumAllocator.

Separating this concatenation functionality from the Text trait avoids difficulties that otherwise would happen with needing to have the DA: DatumAllocator type parameter where not really needed.

The Datum allocation support exists to support TextDatumList, but it hypothetically might be useful to other potential implementations. The DA type argument must be the same as that of the Parsers this is used with. When this is implemented for types that ignore the DatumAllocator, the DA type should be a generic type parameter that covers all (ignored) possibilities.

Required methods

fn concat(self, other: Self, datum_alloc: &mut DA) -> Result<Self, AllocError>

Concatenate two Texts (of the same type) to form a single Text that logically represents this. The datum_alloc argument may be ignored by some (most) implementations and exists only to support implementations like TextDatumList. If the implementation ignores datum_alloc, it is safe to use unwrap on the returned Result.

Loading content...

Implementors

impl<'d, DA, C, ET> TextConcat<DA> for TextDatumList<'d, C, ET> where
    C: TextChunk,
    DA: DatumAllocator<TT = Self, ET = ET, DR = DatumMutRef<'d, Self, ET>>, 
[src]

Enables TextDatumList to be used with Parsers as the produced Datums' text type. This can only be used with Parsers that allocate the same type of Datum that Self uses, which is required by this impl's where bounds.

fn concat(self, other: Self, datum_alloc: &mut DA) -> Result<Self, AllocError>[src]

Link two TextDatumLists to form a single TextDatumList that represents their logical concatenation. Unlike most implementations of TextConcat, this does use the datum_alloc argument to allocate the new Datums that are used as the storage of the nodes of our linked-list approach.

Loading content...