Skip to main content

Module codec

Module codec 

Source
Expand description

The FHIR JSON representation shared by every version module.

Resources carry resourceType; a primitive element is a JSON value plus an optional sibling named with a leading underscore that holds its id and extension; repeating primitives are two arrays aligned with null; integers and decimals are JSON numbers with their lexical form preserved; objects and arrays are never empty; unknown properties are refused (https://hl7.org/fhir/R4B/json.html).

Structs§

ChoiceSlot
The parts of one choice element met while reading an object.
DecodeError
A refused JSON document, located by its element path.
LexicalError
A text outside the lexical form of a FHIR primitive, the form the package’s regex extension on <primitive>.value states (https://hl7.org/fhir/R4/datatypes.html#primitive).
NotANumber
Text that is no JSON number.
Number
A JSON number, in the lexical form the document carried.
Path
The element path being decoded, for error reports.
PrimitiveElement
A primitive’s _name object, written straight to a serializer.
PrimitiveElements
The _name array of a repeating primitive, null at a position that carries no id and no extension.
PrimitiveValue
A primitive’s value, written straight to a serializer.
PrimitiveValues
The value array of a repeating primitive, null at a position that carries only an id or an extension.

Enums§

DecodeErrorKind
Why a JSON document was refused.
EncodeError
Why a value could not be written as JSON.
Value
A JSON document, with every number kept in its lexical form.
ValueConversionError
Why a Value has no serde_json::Value form.

Traits§

Json
A type with a FHIR JSON representation as an object.
Primitive
A FHIR primitive: a JSON value plus an optional element object.

Functions§

boxed
Decodes a resource straight into a box.
decimal_value
A decimal’s lexical form as a JSON number.
element_entry
Writes key with the primitive’s _name object, unless it carries no id and no extension.
element_list_entry
Writes key with the _name array of a repeating primitive, when any position carries an id or an extension.
expect_array
Reads a non-empty JSON array.
expect_bool
Reads a JSON boolean.
expect_decimal
Reads a JSON number keeping its lexical form, for the FHIR decimal.
expect_i32
Reads a JSON number as an i32.
expect_i64_string
Reads a 64-bit integer carried as a JSON string (the R5 integer64 form).
expect_object
Reads a non-empty JSON object.
expect_single
Refuses an array where a single value is expected.
expect_string
Reads a JSON string.
expect_u32
Reads a JSON number as a u32, at least min.
pair_arrays
Pairs a repeating primitive’s value array with its _name array.
primitive_arrays
Serializes a list of primitives as the value array, when any carries a value, and the aligned _name array, when any carries an element object.
resource_type
The resourceType of an object, for dispatch.
value_entry
Writes key with the primitive’s value, unless it carries none.
value_list_entry
Writes key with the value array of a repeating primitive, when any position carries a value.

Type Aliases§

Object
A JSON object, its keys in sorted order.
ValuePair
One position of a repeating primitive: the value and its _name object.