Skip to main content

target_dir_from_metadata

Function target_dir_from_metadata 

Source
pub fn target_dir_from_metadata(json: &str) -> Option<&str>
Expand description

Cargo’s target directory, read out of cargo metadata output.

A string scan rather than a JSON dependency: target_directory is a top-level string in a document this crate never otherwise parses, and the alternative is asking every consumer of this CLI to build serde’s derive for one field.

Returns None when the field is absent, which is the honest answer for output this did not understand: the caller falls back rather than guessing a path and reporting somebody else’s bug.