Skip to main content

Crate xacro_rs

Crate xacro_rs 

Source
Expand description

Xacro processor in Rust.

xacro is an XML macro processor, that expands properties, macros, and conditionals. The crate provides core extensions by default (cwd, env); ROS-specific extensions are available via the builder when needed.

§Quick Start

Process a xacro file:

let urdf = xacro_rs::process_file("robot.xacro")?;

Use process_string for string content. For more control (arguments, extensions, compatibility modes):

let processor = xacro_rs::XacroProcessor::builder()
    .with_arg("robot_name", "my_robot")
    .build();
let urdf = processor.run("robot.xacro")?;

§Examples

See the examples/ directory for complete examples including:

  • Basic file processing
  • Processing from stdin
  • Using arguments and the builder API
  • ROS extensions and YAML support
  • Generic XML macros (non-ROS usage)

§Feature Flags

  • yaml (default): Enable YAML loading with load_yaml()
  • compat (default): Python Xacro compatibility mode.

§Compatibility

This crate aims for feature parity with Python xacro. See the README for status and limitations.

Re-exports§

pub use error::XacroError;
pub use processor::CompatMode;
pub use processor::XacroBuilder;
pub use processor::XacroProcessor;

Modules§

error
extensions
Extension system for $(command args…) substitutions.
processor

Enums§

PropertyScope
Where to define a property

Functions§

process_file
Process a xacro file from the filesystem.
process_string
Process xacro content from a string.