[][src]Function rusp::usp_generator::usp_get_response_from_json

pub fn usp_get_response_from_json<'a>(
    getresp: &[RequestedPathResult<'a>]
) -> Body<'a>

Creates a body for a USP Msg with a USP GetResp response

Arguments

  • result - A vector of Result tuples to put into the GetResp response

Example

use rusp::usp_generator::{usp_get_response_from_json, GetResp};
let json = r#"[{"requested_path": "bar", "err_code" : 0, "err_msg" : "", "resolved_path_results" : [{"resolved_path": "Device.", "result_params": {"Device.Foo": "bar"}}]}]"#;
let deserialised : GetResp = serde_json::from_str(&json).unwrap();
let resp = usp_get_response_from_json(&deserialised);