diff options
Diffstat (limited to 'src/xchan.rs')
-rw-r--r-- | src/xchan.rs | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/xchan.rs b/src/xchan.rs index c67179c..68f7622 100644 --- a/src/xchan.rs +++ b/src/xchan.rs @@ -18,27 +18,17 @@ use crate::{ client::{self, Client}, error::Error, }; -use serde::{Serialize, Serializer}; +//use serde::{Serialize, Serializer}; +use serde::Serialize; +#[derive(Debug, Serialize)] +#[serde(rename_all = "lowercase")] enum XChanSelector<'a> { Address(&'a str), Hash(&'a str), GUID(&'a str), } -impl<'a> Serialize for XChanSelector<'a> { - fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> - where - S: Serializer, - { - match *self { - XChanSelector::Address(addr) => [("address", addr)].serialize(serializer), - XChanSelector::Hash(hash) => [("hash", hash)].serialize(serializer), - XChanSelector::GUID(guid) => [("guid", guid)].serialize(serializer), - } - } -} - pub struct XChanFetcher<'a> { client: &'a Client, data: Option<XChanSelector<'a>>, |