aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/factoid/utils.rs
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2019-07-06 01:32:12 +0200
committerJokler <jokler.contact@gmail.com>2019-07-06 01:32:12 +0200
commit9e427d9063a5d0180b8acc8705c3c2d7b0c01bcc (patch)
treed259160f21a78dcb5252b3078559a6b48b35dd28 /src/plugins/factoid/utils.rs
parent04b9e31fab4ac5725d47f9b500743db3461cd9df (diff)
downloadfrippy-9e427d9063a5d0180b8acc8705c3c2d7b0c01bcc.tar.gz
frippy-9e427d9063a5d0180b8acc8705c3c2d7b0c01bcc.zip
Main: Update dependencies and remove clippy plugin
Diffstat (limited to 'src/plugins/factoid/utils.rs')
-rw-r--r--src/plugins/factoid/utils.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/factoid/utils.rs b/src/plugins/factoid/utils.rs
index 7bd9b20..bd1bf43 100644
--- a/src/plugins/factoid/utils.rs
+++ b/src/plugins/factoid/utils.rs
@@ -5,19 +5,19 @@ use serde_json::{self, Value as SerdeValue};
use super::rlua::Error as LuaError;
use super::rlua::Error::RuntimeError;
-use super::rlua::{Lua, Value as LuaValue};
+use super::rlua::{Context, Value as LuaValue};
use utils::error::ErrorKind::Connection;
use utils::Url;
use failure::Fail;
-pub fn sleep(_: &Lua, dur: u64) -> Result<(), LuaError> {
+pub fn sleep(_: &Context, dur: u64) -> Result<(), LuaError> {
thread::sleep(Duration::from_millis(dur));
Ok(())
}
-pub fn download(_: &Lua, url: String) -> Result<String, LuaError> {
+pub fn download(_: &Context, url: String) -> Result<String, LuaError> {
let url = Url::from(url).max_kib(1024);
match url.request() {
Ok(v) => Ok(v),
@@ -36,7 +36,7 @@ pub fn download(_: &Lua, url: String) -> Result<String, LuaError> {
}
}
-fn convert_value(lua: &Lua, sval: SerdeValue, max_recurs: usize) -> Result<LuaValue, LuaError> {
+fn convert_value<'l>(lua: &Context<'l>, sval: SerdeValue, max_recurs: usize) -> Result<LuaValue<'l>, LuaError> {
if max_recurs == 0 {
return Err(RuntimeError(String::from(
"Reached max recursion level - json is nested too deep",
@@ -74,7 +74,7 @@ fn convert_value(lua: &Lua, sval: SerdeValue, max_recurs: usize) -> Result<LuaVa
Ok(lval)
}
-pub fn json_decode(lua: &Lua, json: String) -> Result<LuaValue, LuaError> {
+pub fn json_decode<'l>(lua: &Context<'l>, json: String) -> Result<LuaValue<'l>, LuaError> {
let ser_val: SerdeValue =
serde_json::from_str(&json).map_err(|e| RuntimeError(e.to_string()))?;