pub struct ArxmlFile(_);
Expand description

An Autosar arxml file

Implementations

Get the filename of this ArxmlFile

Example
println!("filename is : {}", file.filename().display());

Set the filename of this arxml filename

This will not rename any existing file on disk, but the new filename will be used when writing the data.

Example
file.set_filename("foo.arxml");
// or
file.set_filename(&Path::new("bar.arxml"));

Get the AutosarVersion of the file

Example
let version = file.version();

Set the AutosarVersion of the file

The compatibility of the data in the file with the new version will be checked before setting the version. The compatibility check can also be performed manually using the function check_version_compatibility().

If the data is compatible, then the version is set, otherwise an error is raised.

Example
file.set_version(AutosarVersion::Autosar_00050);
Possible Errors

Check if the elements and attributes in this file are compatible with some target_version

All elements and their attributes will be evaluated against the target version according to the specification. The output is a list of incompatible elements

Example
let (error_list, compat_mask) = file.check_version_compatibility(AutosarVersion::Autosar_00050);

Get a reference to the AutosarProject object that contains this file

Example
let project = AutosarProject::new();
let file = project.create_file("test", AutosarVersion::Autosar_00050).unwrap();
let p2 = file.project()?;
assert_eq!(project, p2);
Possible Errors

AutosarDataError::ItemDeleted: The project is no longer valid

Get a referenct to the root <AUTOSAR ...> element of this file

Example
let autosar_element = file.root_element();

Create a depth-first search iterator over all Elements in this file

Example
for (depth, elem) in file.elements_dfs() {
    // ...
}

Serialize the content of the file to a String

Example
let text = file.serialize();

Create a weak reference to this ArxmlFile

A weak reference can be stored without preventing the file from being deallocated. The weak reference has to be upgraded in order to be used, which can fail if the file no longer exists.

See the documentation for Arc

Example
let weak_file = file.downgrade();

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.