Created
April 27, 2023 01:48
-
-
Save Enigo/4a398963291495f14f7f971d5e7bf969 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use serde::de::DeserializeOwned; | |
pub async fn fetch_single_api_response<T: DeserializeOwned>(endpoint: &str) -> reqwest::Result<T> { | |
let result = reqwest::get(endpoint).await?.json::<T>().await?; | |
return Ok(result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment