summaryrefslogtreecommitdiffstats
path: root/librepology/src/v1/api/response.rs
blob: 9f52ab89ee2f00dc22099ad9d1a1b18c9179b169 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::v1::error::Result;
use crate::v1::error::RepologyError;

#[derive(Debug)]
pub struct Response(pub(super) String);

impl Response {
    pub fn deserialize<'de, T: serde::Deserialize<'de>>(&'de self) -> Result<T> {
        serde_json::from_str(&self.0).map_err(RepologyError::from)
    }
}