faucet-source-xml 1.0.0

XML API source connector for the faucet-stream ecosystem
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Serde helper modules for types that don't implement Serialize/Deserialize natively.

/// Serialize/deserialize `reqwest::Method` as a string (e.g. `"GET"`, `"POST"`).
pub mod http_method {
    use serde::{Deserialize, Deserializer, Serializer};

    pub fn serialize<S: Serializer>(method: &reqwest::Method, s: S) -> Result<S::Ok, S::Error> {
        s.serialize_str(method.as_str())
    }

    pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result<reqwest::Method, D::Error> {
        let s = String::deserialize(d)?;
        s.parse().map_err(serde::de::Error::custom)
    }
}