Skip to main content

parse_master_spec

Function parse_master_spec 

Source
pub fn parse_master_spec(xml_content: &str) -> Vec<WorkerTask>
Expand description

Parses master specification XML content into a vector of WorkerTask items.

This function splits the input by <worker_task tags and extracts:

  • id: Unique task identifier from id="..." attribute
  • target: Target file/path from target="..." attribute
  • instruction: The payload content between opening tag and </worker_task>

§Arguments

  • xml_content — Raw XML-ish string containing worker task definitions

§Returns

A Vec<WorkerTask> with all parsed tasks (skips malformed blocks)

§Example

let xml = r#"<worker_task id="w-001" target="src/main.rs">
    // Do something
</worker_task>"#;
let tasks = parse_master_spec(xml);
assert_eq!(tasks.len(), 1);