Skip to main content

reader_with

Function reader_with 

Source
pub fn reader_with(
    lang: &BuiltLang,
    elements: Arc<dyn ElementResolver>,
    payloads: PayloadReaders,
) -> Result<SerdeSession<Flm>, RegistrationError>
Expand description

Creates a reading session over the built language lang, with payload readers.

The session holds the same tables as a writer’s, runs under the language’s recursion guard, and carries the reading environment: the language’s specification providers (known_providers), its structural elements, elements to resolve every other element name found in the data, and payloads to rebuild the payloads of presentation nodes. The readers of FLM’s stored forms are registered on it (register). No profile is set (see the module documentation): a program that caches serialized data calls techy’s set_profile with the same string as on its writer.

Give the session a segment with techy’s push_segment, which returns the position of the segment’s main entry (the object the writer recorded as the one to start from), if it has one; then read objects with read_fragment and read_tree.

§Errors

The registration errors of register.