Skip to main content

process_string

Function process_string 

Source
pub fn process_string(content: &str) -> Result<String, XacroError>
Expand description

Process xacro content from a string.

This is a convenience function that creates a default XacroProcessor and processes the given xacro content string.

For more control over processing (arguments, compatibility modes, extensions), use XacroProcessor::builder() instead.

ยงExamples

let xacro_content = r#"<?xml version="1.0"?>
<robot name="test" xmlns:xacro="http://www.ros.org/wiki/xacro">
  <xacro:property name="width" value="0.5"/>
  <link name="base">
    <visual>
      <geometry>
        <box size="${width} 0.5 0.5"/>
      </geometry>
    </visual>
  </link>
</robot>"#;

let urdf = xacro_rs::process_string(xacro_content)?;
assert!(urdf.contains("0.5 0.5 0.5"));