From 5d9fd8fc5a01dec571e35d6d84ca0636ddbf4517 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 25 Apr 2019 09:37:55 +0200 Subject: Add doc: REST Api type --- librepology/src/v1/restapi.rs | 3 +++ 1 file changed, 3 insertions(+) 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); impl curl::easy::Handler for Collector { fn write(&mut self, data: &[u8]) -> RResult { @@ -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>(&self, request: U) -> Result { let mut easy = Easy2::new(Collector(Vec::new())); easy.get(true)?; -- cgit v1.2.3