diff options
author | Martin Fischer <martin@push-f.com> | 2022-10-28 12:26:59 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2022-10-28 12:29:07 +0200 |
commit | 3433e3dda8917fe02b3b225d5e2829d0ec64946e (patch) | |
tree | ea5cb9bbcd475baf3d350c616857a09d56518a11 /src/lua/serde/error.rs | |
parent | d050c761c0940397b5808934937a8d5e13e670d4 (diff) |
drop gitpad.decode_toml Lua function
The function made sense when we had Lua shebangs but now that they
have been removed, the function doesn't make much sense anymore.
Diffstat (limited to 'src/lua/serde/error.rs')
-rw-r--r-- | src/lua/serde/error.rs | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/src/lua/serde/error.rs b/src/lua/serde/error.rs deleted file mode 100644 index 8d5debf..0000000 --- a/src/lua/serde/error.rs +++ /dev/null @@ -1,58 +0,0 @@ -// vendored from https://github.com/zrkn/rlua_serde because it dependend on an outdated rlua version -// Copyright (c) 2018 zrkn <zrkn@email.su>, licensed under the MIT License - -use std::error::Error as StdError; -use std::fmt; -use std::result::Result as StdResult; - -use rlua::Error as LuaError; -use serde; - -#[derive(Debug)] -pub struct Error(LuaError); - -pub type Result<T> = StdResult<T, Error>; - -impl From<LuaError> for Error { - fn from(err: LuaError) -> Error { - Error(err) - } -} - -impl From<Error> for LuaError { - fn from(err: Error) -> LuaError { - err.0 - } -} - -impl fmt::Display for Error { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - self.0.fmt(fmt) - } -} - -impl StdError for Error { - fn description(&self) -> &'static str { - "Failed to serialize to Lua value" - } -} - -impl serde::ser::Error for Error { - fn custom<T: fmt::Display>(msg: T) -> Self { - Error(LuaError::ToLuaConversionError { - from: "serialize", - to: "value", - message: Some(format!("{}", msg)), - }) - } -} - -impl serde::de::Error for Error { - fn custom<T: fmt::Display>(msg: T) -> Self { - Error(LuaError::FromLuaConversionError { - from: "value", - to: "deserialize", - message: Some(format!("{}", msg)), - }) - } -} |