Skip to navigation
Access a CouchDB view with rust actix_web and loop over its results
06.12.22
use awc::Client; let client = Client::new(); let _res = client.get("http://couchdb.foo.net/gms/_design/script/_view/sapir") .insert_header(("User-Agent", "Actix-web")) .insert_header(("Authorization", "Basic xxxxxxxx")) .send() .await; let _bin = _res.unwrap().body().await.unwrap(); let _s = String::from_utf8_lossy(&_bin); let mut j = json::parse(&_s).unwrap(); for i in 0..j["rows"].len() { println!("{}", j["rows"][i]["id"]); }
https://www.hackertouch.com/how-to-iterate-over-an-array-in-rust.html
Reply
Anonymous
Information Epoch 1742413603
Live free or die.
Home
Notebook
Contact us