Skip to main content

get_structure_definitions

Function get_structure_definitions 

Source
pub fn get_structure_definitions<'a>(
    resource: &'a Resource,
    level: Option<&'static str>,
) -> Result<Vec<&'a StructureDefinition>, String>
Expand description

Retrieves [StructureDefinition] resources from a FHIR [Resource].

This function supports extracting structure definitions from:

  • A [Resource::Bundle], by collecting all entries containing a [Resource::StructureDefinition].
  • A standalone [Resource::StructureDefinition].

The returned definitions can optionally be filtered by their kind using the level parameter:

  • "resource" - Includes resource definitions.
  • "complex-type" - Includes complex type definitions.
  • "primitive-type" - Includes primitive type definitions.

If no level filter is provided, all matching [StructureDefinition] values are returned.

§Arguments

  • resource - The FHIR resource containing one or more structure definitions.
  • level - Optional filter specifying the structure definition category to return.

§Returns

Returns a vector of references to matching [StructureDefinition] values.

§Errors

This function currently does not return any errors during execution and returns Ok in all cases. The Result return type is reserved for future error handling.

§Lifetimes

The returned references borrow from the provided resource and are valid for the same lifetime as the input resource.