diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2023-03-27 22:14:15 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2023-03-27 22:14:15 +0200 |
commit | fe9db878e8f7d8f4bff2a51bb49b66ff84013644 (patch) | |
tree | 60d040e1f61d5c00e86389578b15a536a212aa43 /src/verify.rs | |
parent | 93ee81f05e1cb90c79949d5c57b1d7e3c272dd02 (diff) | |
download | rust-zotapi-fe9db878e8f7d8f4bff2a51bb49b66ff84013644.tar.gz rust-zotapi-fe9db878e8f7d8f4bff2a51bb49b66ff84013644.tar.bz2 rust-zotapi-fe9db878e8f7d8f4bff2a51bb49b66ff84013644.zip |
Add ZotAPI trait and derive macro.
The idea is to try to generate more of the boilerplate code, but for now
we only do the `z()` method definition. There are also some we're not
quite able to replace yet (like XChanRequest) since it also has life
times.
It's a start anyways :)
Diffstat (limited to 'src/verify.rs')
-rw-r--r-- | src/verify.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/verify.rs b/src/verify.rs index 8edb2f1..57e250d 100644 --- a/src/verify.rs +++ b/src/verify.rs @@ -14,11 +14,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. -use crate::{client::Client, error::Error, XChan}; +use crate::{client::Client, error::Error, XChan, ZotAPI}; use serde::Deserialize; use std::convert::TryFrom; +use zotapi_derive::ZotAPI; -#[derive(Deserialize, Debug)] +#[derive(Deserialize, Debug, ZotAPI)] pub struct Channel { #[serde(alias = "channel_id")] pub id: u32, @@ -129,12 +130,6 @@ pub struct Channel { pub xchan: XChan, } -impl Channel { - pub fn z() -> ChannelRequest { - ChannelRequest::default() - } -} - impl<'a> TryFrom<&'a str> for Channel { type Error = Error; |