nostr:npub129gvast08lj986yftn7q5qlnj8yfqufxx0m33s9u5xssjm8c64rsve4kwg what are you going to use it for ? 👀
nostr:npub18wpm7rn8f5tuvuls39hlam6pepzs6qcf4g2wuvqxjvjmfw3qckxsxk8v8s I will give a Linux and a Rust course and I am writing a CLI that does automated checking of tasks that students should do. When they have done the task right, a collective score of the course is raised :D
Kind of automation and gamification of tasks :D
nostr:npub1hjwdnmduf4w67dx22ft7kkcltymgeswz9k5qdrqsc7qch5zxkv7sxfagxz You should in general not block in an async function, but I don't know why it would panic 😅
nostr:npub1hjwdnmduf4w67dx22ft7kkcltymgeswz9k5qdrqsc7qch5zxkv7sxfagxz I found out why:
https://github.com/seanmonstar/reqwest/issues/1450#issuecomment-1022129517
It is a debug assertion.
nostr:npub129gvast08lj986yftn7q5qlnj8yfqufxx0m33s9u5xssjm8c64rsve4kwg The docs in your previous link say "Conversely, the functionality in reqwest::blocking must not be executed within an async runtime, or it will panic when attempting to block. If calling directly from an async function, consider using an async reqwest::Client instead.".
nostr:npub1hjwdnmduf4w67dx22ft7kkcltymgeswz9k5qdrqsc7qch5zxkv7sxfagxz You should in general not block in an async function, but I don't know why it would panic 😅
nostr:npub129gvast08lj986yftn7q5qlnj8yfqufxx0m33s9u5xssjm8c64rsve4kwg Why does it panic within an async runtime?
nostr:npub1hjwdnmduf4w67dx22ft7kkcltymgeswz9k5qdrqsc7qch5zxkv7sxfagxz What do you mean?
Did you know that the great http://pola.rs #rustlang library has a #cli application that lets you run SQL queries over files (csv, json, parquet) and databases? https://github.com/pola-rs/polars/tree/main/polars-cli

nostr:npub1daaawaqtsktl4zcsfxtdex0zq0hwqgx0qfvew5yt6z0nercac37s7v4e50 Thanks for sharing 🤩
nostr:npub129gvast08lj986yftn7q5qlnj8yfqufxx0m33s9u5xssjm8c64rsve4kwg I hope this is only a test... I dont like a rainbow every line.
Also please respect the NOCOLOR env variable! :)
nostr:npub10c6y3qt7d4d87hukhuj9appy50ft7ak0j3fhjrvd0ux7maejdujs8zx2jy yansi respects the NO_COLOR variable ;)
nostr:npub129gvast08lj986yftn7q5qlnj8yfqufxx0m33s9u5xssjm8c64rsve4kwg You can cache Agent, and keep already established connections for speed.
nostr:npub1lxtnww76w6n5js6yvhm0pua0fky96df2q252ssuv70m43gta36eqlewnka That is what `Client` does in `reqwest` too:
Ended up using yansi (1.0.0-rc) for colored terminal output 🎨
https://github.com/SergioBenitez/yansi
Coloring the terminal is fun! :blobcathearteyes:
#RustLang #Rust

nostr:npub1z70sk8dp9daycrrpg4xwss9t0cujpxat5u6ynxc9yy2tvraw890sqgjtuz Never mind, I did just switch to yansi (1.0.0-rc) since it supports everything colored does, but it does not only work on strings! This means that I can use it with the debug formatter {:?}


I did delete my post about the synchronous HTTP client `ureq`. Why reinvent the wheel when `reqwest` already has a blocking API?
https://docs.rs/reqwest/latest/reqwest/blocking/index.html
This means that you can use `reqwest` for async and sync applications. Profit from the strong ecosystem around hyper :D
#RustLang #Rust
nostr:npub129gvast08lj986yftn7q5qlnj8yfqufxx0m33s9u5xssjm8c64rsve4kwg Ah gotcha! Was gonna say you can do that styling in Alacritty, but you want to shell itself to be coloured.
I'll have to check those packages out later and see! Be curious if you land on a good one. :blobfoxcomputer:
nostr:npub1z70sk8dp9daycrrpg4xwss9t0cujpxat5u6ynxc9yy2tvraw890sqgjtuz Went with colored in case you are interested :D
nostr:npub129gvast08lj986yftn7q5qlnj8yfqufxx0m33s9u5xssjm8c64rsve4kwg hmmm what advantage does this have over reqwests sync API?
nostr:npub19pgazvl0rfwjlf057k2q8ss3s8vxgvc8qsl0s6w8yx4lzv9yggmqtyygka Good question. I thought that the blocking version of reqwest would use the tokio runtime under the hood which would be a big overhead. But now that you asked, I did check it again and that does not seem to be the case. ureq is just reinventing the wheel? A good simple crate to study HTTP clients, I guess. Deleting the original post ;)
nostr:npub129gvast08lj986yftn7q5qlnj8yfqufxx0m33s9u5xssjm8c64rsve4kwg Nice, and yeah Reqwest is top tier for sync https stuff. Gloo-Net is a great choice for front-end/WASM stuff as well.
nostr:npub1z70sk8dp9daycrrpg4xwss9t0cujpxat5u6ynxc9yy2tvraw890sqgjtuz You means async ;)
nostr:npub1z70sk8dp9daycrrpg4xwss9t0cujpxat5u6ynxc9yy2tvraw890sqgjtuz Yes. I am not looking for a terminal, I am looking for crate that produces colored terminal output.
Why do we have at least three crates that seem to do the same thing? :blobcatsadpats:
I want terminal colors and found these three crates:
- colored
- yansi
- owo-colors
Any recommendation? :blobthinkingeyes:
#RustLang #Rust
`ureq` is an awesome sync #Rust HTTP client!
https://github.com/algesten/ureq
It is pretty simple! :blobcatcookienom:
If you need a more powerful and async client, use `reqwest`:
https://github.com/seanmonstar/reqwest
#RustLang
I did release some updates to #OxiTraffic, a self-hosted, simple and privacy respecting website traffic tracker 🌐
https://codeberg.org/mo8it/oxitraffic
I did improve the design, add more stats and fix some bugs ✨
I did also finally add some tests 😅
Any feature suggestions? :ablobcathappypaws:
I can host it for you if you want to test it with your website :blobcatheart:
#RustLang #Rust #Analytics #Traffic #Selfhosted #Indieweb



