Skip to main content

target_format_from_name

Function target_format_from_name 

Source
pub fn target_format_from_name(name: &str) -> Option<TargetFormat>
Expand description

Map a format name (with the common aliases) to a TargetFormat, or None if unrecognized. Accepts matpower/m, powermodels-json/powermodels/pm, egret-json/egret, pandapower-json/pandapower/pp, psse/raw, powerworld/aux. Case-insensitive. The one place the bindings (Python, C ABI) share, so a new text format means one new arm here, not three. PyPSA CSV folders are directory inputs with no text target; their aliases are matched by the private is_pypsa_csv_name next to this.

The powermodelsjson/egretjson/pandapowerjson aliases let a SourceFormat’s string form ({:?} lowercased, e.g. "PowerModelsJson") round-trip back to a target, so net.to_format(other.source_format) works for every format.