diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2020-01-03 23:32:44 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2020-01-03 23:32:44 +0100 |
commit | 0c76f0c9727a512475e29b5d099b5b7188f72052 (patch) | |
tree | d1c2b59458c62116447fa2d885113afe6a5378da /src/abook.rs | |
parent | 5f96d9981a6d041f5c8a464cda10a0dc371060f8 (diff) | |
download | rust-zotapi-0c76f0c9727a512475e29b5d099b5b7188f72052.tar.gz rust-zotapi-0c76f0c9727a512475e29b5d099b5b7188f72052.tar.bz2 rust-zotapi-0c76f0c9727a512475e29b5d099b5b7188f72052.zip |
Move Client out of the api objects.
Also make constructor functions in the zotapi namespace.
Diffstat (limited to 'src/abook.rs')
-rw-r--r-- | src/abook.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/abook.rs b/src/abook.rs index 5f34ff5..40ef5a4 100644 --- a/src/abook.rs +++ b/src/abook.rs @@ -20,16 +20,14 @@ use crate::{ }; -pub struct AbookFetcher<'a> { - client: &'a Client, -} +pub struct Abook; -impl<'a> AbookFetcher<'a> { - pub fn new(client: &'a Client) -> AbookFetcher<'a> { - AbookFetcher { client } - } +pub fn abook() -> Abook { + Abook {} +} - pub fn fetch(&self) -> Result<String, Error> { - self.client.fetch_stream("abook", &()) +impl Abook { + pub fn fetch(&self, client: &Client) -> Result<String, Error> { + client.fetch_stream("abook", &()) } } |