Struct autosar_data_specification::ElementType
source · [−]pub struct ElementType(_);
Expand description
ElementType is an abstraction over element types in the specification.
It provides no public fields, but it has methods to get all the info needed to parse an arxml element.
Implementations
sourceimpl ElementType
impl ElementType
sourcepub fn get_sub_element_version_mask(
&self,
element_indices: &[usize]
) -> Option<u32>
pub fn get_sub_element_version_mask(
&self,
element_indices: &[usize]
) -> Option<u32>
get the version mask of a sub element
sourcepub fn get_sub_element_multiplicity(
&self,
element_indices: &[usize]
) -> Option<ElementMultiplicity>
pub fn get_sub_element_multiplicity(
&self,
element_indices: &[usize]
) -> Option<ElementMultiplicity>
get the multiplicity of a sub element within the current ElementType
The sub element is identified by an indx list, as returned by find_sub_element()
sourcepub fn get_sub_element_container_mode(
&self,
element_indices: &[usize]
) -> ContentMode
pub fn get_sub_element_container_mode(
&self,
element_indices: &[usize]
) -> ContentMode
get the ContentMode of the container of a sub element of the current ElementType
The sub element is identified by an index list, as returned by find_sub_element()
sourcepub fn find_sub_element(
&self,
target_name: ElementName,
version: u32
) -> Option<(ElementType, Vec<usize>)>
pub fn find_sub_element(
&self,
target_name: ElementName,
version: u32
) -> Option<(ElementType, Vec<usize>)>
find a sub element in the specification of the current ElementType
Note: Version here is NOT an AutosarVersion, it is a u32. it is a bitmask which can contain multiple AutosarVersions, or any version by using u32::MAX
In almost all cases this is simple: there is a flat list of sub elements that either contains the target_name or not. The result in those simple cases is a vec with one entry which is the index of the element in the list. There are a handfull of complicated situations though, where the list of sub elements contains groups of elements that have a different ContentMode than the other elements.
For example:
PRM-CHAR (Sequence)
-> Element: COND
-> Group (Choice)
-> Group (Sequence)
-> Group (Choice)
-> Group (Sequence)
-> Element: ABS
-> Element: TOL
-> Group (Sequence)
-> Element: MIN
-> Element: TYP
-> Element: MAX
-> Element: PRM-UNIT
-> Element: TEXT
-> Element: REMARK
When searching for TOL in PRM-CHAR, the result should be Some(vec![1, 0, 0, 0, 1])!
sourcepub fn find_common_group(
&self,
element_indices: &[usize],
element_indices2: &[usize]
) -> ElementType
pub fn find_common_group(
&self,
element_indices: &[usize],
element_indices2: &[usize]
) -> ElementType
find the commmon group of two subelements of the current ElementType
The subelements are identified by their index lists, returned by find_sub_element().
In simple cases without sub-groups of elements, the “common group” is simply the current ElementType.
sourcepub fn is_named_in_version(&self, version: AutosarVersion) -> bool
pub fn is_named_in_version(&self, version: AutosarVersion) -> bool
are elements of this elementType named in the given Autosar version
Named elements must have a SHORT-NAME sub element. For some elements this depends on the Autosar version.
One example of this is END-2-END-METHOD-PROTECTION-PROPS, which was first defined in Autosar_00048, but only has a name in Autosar_00050.
sourcepub fn content_mode(&self) -> ContentMode
pub fn content_mode(&self) -> ContentMode
get the content mode for this ElementType
sourcepub fn chardata_spec(&self) -> Option<&'static CharacterDataSpec>
pub fn chardata_spec(&self) -> Option<&'static CharacterDataSpec>
get the character data spec for this ElementType
sourcepub fn find_attribute_spec(
&self,
attrname: AttributeName
) -> Option<(&'static CharacterDataSpec, bool, u32)>
pub fn find_attribute_spec(
&self,
attrname: AttributeName
) -> Option<(&'static CharacterDataSpec, bool, u32)>
find the spec for a single attribute by name
sourcepub fn attribute_spec_iter(&self) -> AttrDefinitionsIterⓘNotable traits for AttrDefinitionsIterimpl Iterator for AttrDefinitionsIter type Item = (AttributeName, &'static CharacterDataSpec, bool);
pub fn attribute_spec_iter(&self) -> AttrDefinitionsIterⓘNotable traits for AttrDefinitionsIterimpl Iterator for AttrDefinitionsIter type Item = (AttributeName, &'static CharacterDataSpec, bool);
create an iterator over all attribute definitions in the current ElementType
sourcepub fn sub_element_spec_iter(&self) -> SubelemDefinitionsIterⓘNotable traits for SubelemDefinitionsIterimpl Iterator for SubelemDefinitionsIter type Item = (ElementName, ElementType, u32, u32);
pub fn sub_element_spec_iter(&self) -> SubelemDefinitionsIterⓘNotable traits for SubelemDefinitionsIterimpl Iterator for SubelemDefinitionsIter type Item = (ElementName, ElementType, u32, u32);
create an iterator over all sub elements of the current ElementType
Trait Implementations
sourceimpl Clone for ElementType
impl Clone for ElementType
sourcefn clone(&self) -> ElementType
fn clone(&self) -> ElementType
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more