pub struct SidecarSpec {
pub element: String,
pub extension: String,
pub original_format: Option<String>,
}Expand description
A rule that extracts an XML element’s text content to a typed companion (“sidecar”) file during disassembly, and injects it back during reassembly.
Why: XML formats sometimes embed non-XML blobs — OpenAPI YAML, WSDL, JSON schemas — as escaped text inside a single element. Extracting those blobs to their own typed files lets native tooling (formatters, linters, IDE plugins) operate on them directly, keeps large content changes out of the XML diff, and makes the surrounding XML easier to read and review. The roundtrip is lossless: reassembly reads the sidecar and injects the raw content back before writing the final XML.
Format: element_name:extension, e.g. "schema:yaml". Multiple specs
are passed as a slice; use comma separation at the CLI/NAPI layer when
parsing from a string.
Fields§
§element: StringName of the XML element whose text content is extracted.
extension: StringFile extension for the sidecar file (without leading dot), e.g. "yaml".
original_format: Option<String>Format of the content as it existed inside the XML before extraction
(“json” or “yaml”). Detected at disassembly time and stored in
.sidecars.json so reassembly can convert the sidecar back to its
original format before injecting it into the XML. None means the
content was not recognised as JSON or YAML (raw pass-through).
Trait Implementations§
Source§impl Clone for SidecarSpec
impl Clone for SidecarSpec
Source§fn clone(&self) -> SidecarSpec
fn clone(&self) -> SidecarSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more