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§

source§

impl ElementType

source

pub fn get_sub_element_version_mask( &self, element_indices: &[usize] ) -> Option<u32>

get the version mask of a sub element

source

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()

source

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()

source

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])!

source

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.

source

pub fn is_named(&self) -> bool

are elements of this ElementType named in any Autosar version

source

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.

source

pub fn is_ref(&self) -> bool

is the ElementType a reference

source

pub fn content_mode(&self) -> ContentMode

get the content mode for this ElementType

source

pub fn chardata_spec(&self) -> Option<&'static CharacterDataSpec>

get the character data spec for this ElementType

source

pub fn find_attribute_spec( &self, attrname: AttributeName ) -> Option<AttributeSpec>

find the spec for a single attribute by name

source

pub fn attribute_spec_iter(&self) -> AttrDefinitionsIter

create an iterator over all attribute definitions in the current ElementType

source

pub fn sub_element_spec_iter(&self) -> SubelemDefinitionsIter

create an iterator over all sub elements of the current ElementType

source

pub fn is_ordered(&self) -> bool

Is the current ElementType ordered

It his is true, then the position of the sub elements of this element is semantically meaningful and they may not be sorted / re-ordered without changing the meaning of the file.

An example of this is ARGUMENTS in BSW-MODULE-ENTRY. ARGUMENTS is ordered, because each of its SW-SERVICE-ARG sub elements represents a function argument

source

pub fn splittable(&self) -> u32

Is the current ElementType splittable

This function returns a bitfield that indicates in which versions (if any) the ElementType is marked as splittable. A splittable element may be split across multiple arxml files

source

pub fn splittable_in(&self, version: AutosarVersion) -> bool

Is the current ElementType splittable in the given version

A splittable element may be split across multiple arxml files

source

pub fn reference_dest_value(&self, other: &ElementType) -> Option<EnumItem>

find the correct EnumItem to use in the DEST attribute when referring from this element to the other element

Returns Some(enum_item) it the reference is possible, and None otherwise.

Example:

When referring to a <CAN-TP-CONNECTION><IDENT><SHORT-NAME>foo... the referrring <PHYSICAL-REQUEST-REF [...]> must set DEST=“TP-CONNECTION-IDENT”

source

pub const ROOT: Self = _

ElementType::ROOT is the root ElementType of the Autosar arxml document: this is the ElementType of the AUTOSAR element

Trait Implementations§

source§

impl Clone for ElementType

source§

fn clone(&self) -> ElementType

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ElementType

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for ElementType

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq<ElementType> for ElementType

source§

fn eq(&self, other: &ElementType) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for ElementType

source§

impl Eq for ElementType

source§

impl StructuralEq for ElementType

source§

impl StructuralPartialEq for ElementType

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.