Function dilla_describer::describe
source · pub fn describe(artefact: &str, id: &str) -> String
Expand description
Prints the description of artifacts or a single artifact if an ID is provided.
Arguments
artefact
- An optional reference to a string representing the artifact.id
- An optional reference to a string representing the ID.
Example
use serde_json::json;
use dilla_describer::describe;
let result = describe("tests", "test");
assert_eq!(result, "\"test\"");
let result = describe("tests", "");
assert_eq!(result, "{\n \"test\": \"test\"\n}");
Errors
If an error occurs while parsing the JSON or executing the query, an error message will be printed.
Panics
This function assumes that the JSON value defined by the DEFINITIONS
constant is well-formed and can be successfully queried.
It may panic if the JSON is invalid.