Skip to main content

parse_response

Function parse_response 

Source
pub fn parse_response<T>(body_text: &str) -> Result<T>
Expand description

Parse JSON response body with debug logging.

This helper function deserializes JSON response text and logs debug information about the response and any parsing errors. Used internally by API clients.

§Type Parameters

  • T - The target type to deserialize into. Must implement DeserializeOwned.

§Arguments

  • body_text - Raw JSON response body as a string

§Errors

Returns a ClientError::JsonParse if deserialization fails.

§Example

use wme_client::parse_response;
use wme_models::ProjectInfo;

let body_text = r#"{"identifier": "enwiki", "name": "English Wikipedia"}"#;
let project: ProjectInfo = parse_response(body_text)?;