1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
//! OpenSCENARIO-rs: Rust library for parsing and manipulating OpenSCENARIO files
//!
//! This library provides a type-safe, serde-based implementation for parsing,
//! manipulating, and generating OpenSCENARIO files in Rust.
//!
//! # Features
//!
//! - **Type-safe parsing** - Full type system for OpenSCENARIO specification
//! - **Parameter support** - Handle `${parameter}` references with resolution
//! - **Validation** - Schema validation and semantic checks (with `validation` feature)
//! - **Builder pattern** - Programmatic scenario construction (with `builder` feature)
//!
//! # Quick Start
//!
//! ```rust,no_run
//! use openscenario_rs::{parse_file, Result, OpenScenarioDocumentType};
//!
//! fn main() -> Result<()> {
//! let document = parse_file("scenario.xosc")?;
//! println!("Author: {}", document.file_header.author.as_literal().unwrap());
//!
//! match document.document_type() {
//! OpenScenarioDocumentType::Scenario => {
//! if let Some(entities) = &document.entities {
//! println!("Entities: {}", entities.scenario_objects.len());
//! }
//! }
//! OpenScenarioDocumentType::ParameterVariation => {
//! println!("Parameter variation file");
//! }
//! OpenScenarioDocumentType::Catalog => {
//! println!("Catalog file");
//! }
//! OpenScenarioDocumentType::Unknown => {
//! println!("Unknown document type");
//! }
//! }
//! Ok(())
//! }
//! ```
// Module declarations
// Re-export core types for convenience
pub use ;
pub use ;
// Re-export parser functions
pub use ;
// Re-export choice group infrastructure
pub use ;
// Re-export expression evaluation
pub use evaluate_expression;
// Re-export catalog system
pub use ;
// Feature-gated re-exports
pub use ScenarioBuilder;
// High-level convenience functions
use Path;
/// Parse an OpenSCENARIO file from the filesystem
///
/// This is a convenience function that wraps `parser::xml::parse_from_file`
/// with additional context and error handling.
///
/// # Example
/// ```rust,no_run
/// use openscenario_rs::parse_file;
///
/// let scenario = parse_file("examples/highway.xosc")?;
/// # Ok::<(), openscenario_rs::Error>(())
/// ```
/// Parse a catalog file from the filesystem
///
/// This is a convenience function that wraps `parser::xml::parse_catalog_from_file`
/// with additional context and error handling.
///
/// # Example
/// ```rust,no_run
/// use openscenario_rs::parse_catalog_file;
///
/// let catalog = parse_catalog_file("catalogs/vehicles.xosc")?;
/// # Ok::<(), openscenario_rs::Error>(())
/// ```
/// Parse a catalog document from a string
///
/// This is a convenience function that wraps `parser::xml::parse_catalog_from_str`
/// with additional context and error handling.
///
/// # Example
/// ```rust
/// use openscenario_rs::parse_catalog_str;
///
/// let xml = r#"
/// <?xml version="1.0" encoding="UTF-8"?>
/// <OpenSCENARIO>
/// <FileHeader author="Test" date="2024-01-01" description="Test" revMajor="1" revMinor="0"/>
/// <Catalog name="TestCatalog"/>
/// </OpenSCENARIO>
/// "#;
///
/// let catalog = parse_catalog_str(xml)?;
/// # Ok::<(), openscenario_rs::Error>(())
/// ```
/// Parse an OpenSCENARIO document from a string
///
/// This is a convenience function that wraps `parser::xml::parse_from_str`
/// with additional context and error handling.
///
/// # Example
/// ```rust
/// use openscenario_rs::parse_str;
///
/// let xml = r#"
/// <?xml version="1.0" encoding="UTF-8"?>
/// <OpenSCENARIO>
/// <FileHeader author="Test" date="2024-01-01" description="Test" revMajor="1" revMinor="0"/>
/// <Entities/>
/// <Storyboard><Init><Actions/></Init></Storyboard>
/// </OpenSCENARIO>
/// "#;
///
/// let scenario = parse_str(xml)?;
/// # Ok::<(), openscenario_rs::Error>(())
/// ```
/// Serialize an OpenSCENARIO document to XML string
///
/// This is a convenience function that wraps `parser::xml::serialize_to_string`.
///
/// # Example
/// ```rust
/// use openscenario_rs::{serialize_str, OpenScenario};
///
/// let scenario = OpenScenario::default();
/// let xml = serialize_str(&scenario)?;
/// println!("{}", xml);
/// # Ok::<(), openscenario_rs::Error>(())
/// ```