Skip to content

Commit

Permalink
Specification enhancements
Browse files Browse the repository at this point in the history
 - ordered and splittable are now accurate
 - can query if elements are restricted to "classic platform", "adaptive platform", or not restricted
 - create feature "docstrings" allows the xsd docstring to be retrieved
  • Loading branch information
DanielT committed Dec 14, 2023
1 parent 418f6af commit af70d01
Show file tree
Hide file tree
Showing 7 changed files with 24,266 additions and 23,679 deletions.
3 changes: 3 additions & 0 deletions autosar-data-specification/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ keywords = ["arxml", "automotive", "file-format", "Autosar"]
categories = ["parser-implementations"]
repository = "https://github.com/DanielT/autosar-data"

[features]
docstrings = []

[dependencies]
num-derive = "0.4.0"
num-traits = "0.2.16"
5 changes: 3 additions & 2 deletions autosar-data-specification/src/attributename.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::hashfunc;

#[derive(Debug)]
/// The error type `ParseAttributeNameError` is returned when `from_str`() / parse() fails for `AttributeName`
/// The error type `ParseAttributeNameError` is returned when `from_str()` / `parse()` fails for `AttributeName`
pub struct ParseAttributeNameError;

#[allow(dead_code, non_camel_case_types)]
Expand Down Expand Up @@ -234,7 +234,8 @@ impl AttributeName {
/// get the str corresponding to an item
///
/// The returned &str has static lifetime, becasue it is a reference to an entry in a list of constants
#[must_use] pub fn to_str(&self) -> &'static str {
#[must_use]
pub fn to_str(&self) -> &'static str {
AttributeName::STRING_TABLE[*self as usize]
}
}
Expand Down
7 changes: 5 additions & 2 deletions autosar-data-specification/src/autosarversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use num_derive::FromPrimitive;
use num_traits::cast::FromPrimitive;

#[derive(Debug)]
/// Error type returned when `from_str` / parse for `AutosarVersion` fails
/// Error type returned when `from_str()` / `parse()` for `AutosarVersion` fails
pub struct ParseAutosarVersionError;

#[allow(non_camel_case_types)]
Expand Down Expand Up @@ -75,6 +75,7 @@ impl AutosarVersion {
Self::Autosar_00049 => "AUTOSAR_00049.xsd",
Self::Autosar_00050 => "AUTOSAR_00050.xsd",
Self::Autosar_00051 => "AUTOSAR_00051.xsd",

}
}

Expand Down Expand Up @@ -104,6 +105,7 @@ impl AutosarVersion {
Self::Autosar_00049 => "AUTOSAR R20-11",
Self::Autosar_00050 => "AUTOSAR R21-11",
Self::Autosar_00051 => "AUTOSAR R22-11",

}
}

Expand All @@ -118,7 +120,7 @@ impl AutosarVersion {
Self::from_u32(n)
}

/// `AutosarVersion::LATEST` is an alias of whichever is the latest version, currently `Autosar_00051`
/// `AutosarVersion::LATEST` is an alias of which ever is the latest version
pub const LATEST: AutosarVersion = AutosarVersion::Autosar_00051;
}

Expand Down Expand Up @@ -156,3 +158,4 @@ impl std::fmt::Display for AutosarVersion {
f.write_str(self.describe())
}
}

5 changes: 3 additions & 2 deletions autosar-data-specification/src/elementname.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::hashfunc;

#[derive(Debug)]
/// The error type `ParseElementNameError` is returned when `from_str`() / parse() fails for `ElementName`
/// The error type `ParseElementNameError` is returned when `from_str()` / `parse()` fails for `ElementName`
pub struct ParseElementNameError;

#[allow(dead_code, non_camel_case_types)]
Expand Down Expand Up @@ -11956,7 +11956,8 @@ impl ElementName {
/// get the str corresponding to an item
///
/// The returned &str has static lifetime, becasue it is a reference to an entry in a list of constants
#[must_use] pub fn to_str(&self) -> &'static str {
#[must_use]
pub fn to_str(&self) -> &'static str {
ElementName::STRING_TABLE[*self as usize]
}
}
Expand Down
5 changes: 3 additions & 2 deletions autosar-data-specification/src/enumitem.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::hashfunc;

#[derive(Debug)]
/// The error type `ParseEnumItemError` is returned when `from_str`() / parse() fails for `EnumItem`
/// The error type `ParseEnumItemError` is returned when `from_str()` / `parse()` fails for `EnumItem`
pub struct ParseEnumItemError;

#[allow(dead_code, non_camel_case_types)]
Expand Down Expand Up @@ -5020,7 +5020,8 @@ impl EnumItem {
/// get the str corresponding to an item
///
/// The returned &str has static lifetime, becasue it is a reference to an entry in a list of constants
#[must_use] pub fn to_str(&self) -> &'static str {
#[must_use]
pub fn to_str(&self) -> &'static str {
EnumItem::STRING_TABLE[*self as usize]
}
}
Expand Down
Loading

0 comments on commit af70d01

Please sign in to comment.