diff options
| author | delta <darkussdelta@gmail.com> | 2025-07-04 00:38:29 +0200 |
|---|---|---|
| committer | delta <darkussdelta@gmail.com> | 2025-07-04 00:38:29 +0200 |
| commit | b3530d7c4a102935fa26498a160ee1dc6c1e9c03 (patch) | |
| tree | d7751206a694bc5de2d6b34b0c077cfcd1855798 /.config/awesome/quarrel/native/src/http.rs | |
| parent | df75ec5ed5e3848c497f0439acb43ec9246ad3e7 (diff) | |
:3
Diffstat (limited to '.config/awesome/quarrel/native/src/http.rs')
| -rw-r--r-- | .config/awesome/quarrel/native/src/http.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/.config/awesome/quarrel/native/src/http.rs b/.config/awesome/quarrel/native/src/http.rs new file mode 100644 index 0000000..e995556 --- /dev/null +++ b/.config/awesome/quarrel/native/src/http.rs @@ -0,0 +1,22 @@ +use ureq::{Agent, agent}; +use std::{sync::LazyLock, thread}; +use mlua::prelude::*; + +static AGENT: LazyLock<Agent> = LazyLock::new(|| agent()); + +struct Stream(ureq::Body); + +pub fn get(_: &Lua, url: String, callback: LuaFunction, err_callback: LuaFunction) -> LuaResult<()> { + thread::spawn(|| { + match AGENT.get(url).call() { + Ok(body) => { + + }, + Err(err) => { + err_callback.call(err.to_string()); + } + } + // callback.call::<>() + }); + Ok(()) +} |
