autosar-data-specification

Crates.io Github Actions codecov

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 filename | description | |-------------------|---------------------------| | AUTOSAR4-0-1.xsd | AUTOSAR 4.0.1 | | AUTOSAR4-0-2.xsd | AUTOSAR 4.0.2 | | AUTOSAR4-0-3.xsd | AUTOSAR 4.0.3 | | AUTOSAR4-1-1.xsd | AUTOSAR 4.1.1 | | AUTOSAR4-1-2.xsd | AUTOSAR 4.1.2 | | AUTOSAR4-1-3.xsd | AUTOSAR 4.1.3 | | AUTOSAR4-2-1.xsd | AUTOSAR 4.2.1 | | AUTOSAR4-2-2.xsd | AUTOSAR 4.2.2 | | AUTOSAR4-3-0.xsd | AUTOSAR 4.3.0 | | AUTOSAR00042.xsd | AUTOSAR Adaptive 17-03 | | AUTOSAR00043.xsd | AUTOSAR Adaptive 17-10 | | AUTOSAR00044.xsd | AUTOSAR Classic 4.3.1 | | AUTOSAR00045.xsd | AUTOSAR Adaptive 18-03 | | AUTOSAR00046.xsd | AUTOSAR Classic 4.4.0 / Adaptive 18-10 | | AUTOSAR00047.xsd | AUTOSAR Adaptive 19-03 | | AUTOSAR00048.xsd | AUTOSAR 4.5.0 | | AUTOSAR00049.xsd | AUTOSAR R20-11 | | AUTOSAR00050.xsd | AUTOSAR R21-11 | | AUTOSAR_00051.xsd | AUTOSAR 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.

Example

```rust use autosardataspecification::*; use std::str::FromStr;

let roottype = ElementType::ROOT; // parsing an element let elementnametext = "AR-PACKAGES"; let elementname = ElementName::fromstr(elementnametext).unwrap(); asserteq!(element_name, ElementName::ArPackages);

let versionmask = AutosarVersion::Autosar430 as u32; if let Some((elementtype, indexlist)) = roottype.findsubelement( elementname, versionmask ) { // parsing an attribute let attributename = AttributeName::fromstr("UUID").unwrap(); if let Some(attributespec) = elementtype.findattributespec(attributename) { // ... } // ... } ```