diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2019-04-25 09:37:55 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@atos.net> | 2019-04-25 09:37:55 +0200 |
commit | 5d9fd8fc5a01dec571e35d6d84ca0636ddbf4517 (patch) | |
tree | ff0d9ff03344f266e8152c3539d96625f73e79b5 | |
parent | 79d82cf3d349d7914de5e198d1e191171a8fcea6 (diff) |
Add doc: REST Api type
-rw-r--r-- | librepology/src/v1/restapi.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/librepology/src/v1/restapi.rs b/librepology/src/v1/restapi.rs index df26135..2ac593d 100644 --- a/librepology/src/v1/restapi.rs +++ b/librepology/src/v1/restapi.rs @@ -7,6 +7,7 @@ use curl::easy::Easy2; use crate::v1::types::{Package, Problem}; use crate::v1::api::Api; +/// Private helper type for collecting data from the curl library struct Collector(Vec<u8>); impl curl::easy::Handler for Collector { fn write(&mut self, data: &[u8]) -> RResult<usize, curl::easy::WriteError> { @@ -15,6 +16,7 @@ impl curl::easy::Handler for Collector { } } +/// Representational object for the REST Api of repology pub struct RestApi { /// Base url repology: String, @@ -25,6 +27,7 @@ impl RestApi { Self { repology } } + /// Helper function for sending a request via the curl library fn send_request<U: AsRef<str>>(&self, request: U) -> Result<String> { let mut easy = Easy2::new(Collector(Vec::new())); easy.get(true)?; |