ietf

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 35b3fbcb83522a3a63bd020dd95609fe23f91c05
parent 10f392e39004f6af22207e20dbe2b9dc17292999
Author: cy6erlion <dev@merely.tech>
Date:   Tue, 12 Jan 2021 11:45:36 +0200

change fetch return types

Diffstat:
Msrc/fetch.rs | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/fetch.rs b/src/fetch.rs @@ -1,21 +1,19 @@ // Download RFC index file -pub fn index() -> Result<(), minreq::Error> { +pub fn index() -> Result<Vec<String>, minreq::Error> { println!("Fetching RFC index"); let response = minreq::get("https://www.rfc-editor.org/rfc-index.txt").send()?; let data = scrape(response.as_str()?); - super::storage::persist_index(data); - Ok(()) + Ok(data) } // Download RFC localy -pub fn rfc(sn: u32) -> Result<(), minreq::Error> { +pub fn rfc(sn: u32) -> Result<String, minreq::Error> { println!("Fetching RFC #{}", sn); let address = format!("https://www.rfc-editor.org/rfc/rfc{}.txt", sn); println!("{}", address); let response = minreq::get(&address).send()?; - super::storage::persist_rfc(sn, response.as_str()?); - Ok(()) + Ok(String::from(response.as_str()?)) } // TODO: fix bug causing not to return the last RFC