Crate autosar_data_specification

source ·
Expand description

Specification of the Autosar arxml file format in the form of rust data structures

This crate exists to support the autosar-data crate.

The Autosar data model is originally specified as .xsd files - one for each version of the standard. All these separate xsd files were parsed into data structures and combined; this crate contains the combined specification data of all 19 Autosar 4 standard revisions.

§Supported standards:

xsd filenamedescription
AUTOSAR_4-0-1.xsdAUTOSAR 4.0.1
AUTOSAR_4-0-2.xsdAUTOSAR 4.0.2
AUTOSAR_4-0-3.xsdAUTOSAR 4.0.3
AUTOSAR_4-1-1.xsdAUTOSAR 4.1.1
AUTOSAR_4-1-2.xsdAUTOSAR 4.1.2
AUTOSAR_4-1-3.xsdAUTOSAR 4.1.3
AUTOSAR_4-2-1.xsdAUTOSAR 4.2.1
AUTOSAR_4-2-2.xsdAUTOSAR 4.2.2
AUTOSAR_4-3-0.xsdAUTOSAR 4.3.0
AUTOSAR_00042.xsdAUTOSAR Adaptive 17-03
AUTOSAR_00043.xsdAUTOSAR Adaptive 17-10
AUTOSAR_00044.xsdAUTOSAR Classic 4.3.1
AUTOSAR_00045.xsdAUTOSAR Adaptive 18-03
AUTOSAR_00046.xsdAUTOSAR Classic 4.4.0 / Adaptive 18-10
AUTOSAR_00047.xsdAUTOSAR Adaptive 19-03
AUTOSAR_00048.xsdAUTOSAR 4.5.0
AUTOSAR_00049.xsdAUTOSAR R20-11
AUTOSAR_00050.xsdAUTOSAR R21-11
AUTOSAR_00051.xsdAUTOSAR R22-11

§Using the crate

The main datatype is the ElementType. The type of the <AUTOSAR> element at the root of every arxml file is available as ElementType::ROOT.

§Crate features

  • docstrings - Enables the function ElementType::docstring, which allows you to retrieve element documentation. This feature increases the size of the compiled code, because all docstrings are compiled in. It is disabled by default.

§Note

It is not possible to directly convert between ElementNames and ElementTypes, since this is an n:m mapping. If the content of two differently named elements is structurally identical, then they have the same ElementType; on the other side there are several elements that have different content depending in the context in which they appear.

§Example

let root_type = ElementType::ROOT;

// parsing an element
let element_name_text = "AR-PACKAGES";
let element_name = ElementName::from_str(element_name_text).unwrap();
assert_eq!(element_name, ElementName::ArPackages);

let version_mask = AutosarVersion::Autosar_4_3_0 as u32;
if let Some((element_type, index_list)) = root_type.find_sub_element(
    element_name,
    version_mask
) {
    // parsing an attribute
    let attribute_name = AttributeName::from_str("UUID").unwrap();
    if let Some(attribute_spec) = element_type.find_attribute_spec(attribute_name) {
        // ...
    }

    // ...
}

Structs§

Enums§

  • Enum of all attribute names in Autosar
  • Enum of all Autosar versions
  • Specifies the data type and restrictions of the character data in an element or attribute
  • The ContentMode specifies what content may occur inside an element
  • ElementMultiplicity specifies how often a single child element may occur within its parent
  • Enum of all element names in Autosar
  • Enum of all possible enum values in Autosar
  • StdRestrict is used to indicate if an element is restricted to either Classic or Adaptive

Functions§