pub struct Engine<'a, X> { /* private fields */ }Expand description
Runs StructureMaps.
Implementations§
Source§impl<'a, X: Expressions> Engine<'a, X>
impl<'a, X: Expressions> Engine<'a, X>
pub fn new(definitions: &'a dyn Definitions, expressions: X) -> Self
Sourcepub fn with_trace(self, trace: bool) -> Self
pub fn with_trace(self, trace: bool) -> Self
Records a debug trace of each transform: see Trace.
Sourcepub fn with_concept_maps(self, concept_maps: &'a dyn ConceptMapResolver) -> Self
pub fn with_concept_maps(self, concept_maps: &'a dyn ConceptMapResolver) -> Self
Where translate finds ConceptMaps that are not contained in the map.
Sourcepub fn with_translator(self, translator: &'a dyn TranslateService) -> Self
pub fn with_translator(self, translator: &'a dyn TranslateService) -> Self
A terminology service for translate with ConceptMaps neither the map nor the resolver
holds.
Sourcepub fn with_limits(self, limits: Limits) -> Self
pub fn with_limits(self, limits: Limits) -> Self
How much a transform may do; see Limits.
Sourcepub fn with_cancellation(self, cancel: &'a AtomicBool) -> Self
pub fn with_cancellation(self, cancel: &'a AtomicBool) -> Self
A flag the caller sets to stop running transforms; they fail with
ErrorKind::Cancelled at the next rule.
Sourcepub fn with_template_versions(self, versions: bool) -> Self
pub fn with_template_versions(self, versions: bool) -> Self
Whether a value carries a template only with the template’s version (templateId
extension), as a profile’s identifier states it — the default — or with any version of
it (the same root). Converters that must recognise documents written against earlier
versions of the templates turn versions off.
Sourcepub fn with_lenient_translations(self, lenient: bool) -> Self
pub fn with_lenient_translations(self, lenient: bool) -> Self
What translate does with a code whose ConceptMap element has no usable target (R4
unmatched or disjoint, R5 not-related-to, or several): fail the transform, as the
reference engine does (the default), or leave the target unset and report a warning, as
for a code the ConceptMap does not list. Converters of whole documents leave it out.
Sourcepub fn with_ids(self, ids: &'a dyn IdGenerator) -> Self
pub fn with_ids(self, ids: &'a dyn IdGenerator) -> Self
Where uuid() and new resource ids come from; random by default.
Sourcepub fn with_maps(self, maps: &'a dyn MapResolver) -> Self
pub fn with_maps(self, maps: &'a dyn MapResolver) -> Self
Where the maps named in imports come from.
Sourcepub async fn transform(
&self,
map: &StructureMap,
source: &Value,
) -> Result<Transformed, Error>
pub async fn transform( &self, map: &StructureMap, source: &Value, ) -> Result<Transformed, Error>
Transforms source with the map’s first group; the target is created from the type of
that group’s target parameter.
Sourcepub async fn transform_into(
&self,
map: &StructureMap,
source: &Value,
target: &Value,
) -> Result<Transformed, Error>
pub async fn transform_into( &self, map: &StructureMap, source: &Value, target: &Value, ) -> Result<Transformed, Error>
Transforms source into an existing target.