Allow returning Result<(), E> where E: DisplayLuaError
This commit is contained in:
parent
85c1d6a82a
commit
9b3c37369b
|
@ -109,7 +109,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gmod"
|
||||
version = "16.0.0"
|
||||
version = "16.0.1"
|
||||
dependencies = [
|
||||
"cfg_table",
|
||||
"cstr",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "gmod"
|
||||
version = "16.0.0"
|
||||
version = "16.0.1"
|
||||
authors = ["William Venner <william@venner.io>"]
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
|
|
|
@ -62,3 +62,12 @@ impl<E: DisplayLuaError> From<Result<i32, E>> for ValuesReturned {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl<E: DisplayLuaError> From<Result<(), E>> for ValuesReturned {
|
||||
#[inline(always)]
|
||||
fn from(res: Result<(), E>) -> ValuesReturned {
|
||||
match res {
|
||||
Ok(_) => ValuesReturned(0),
|
||||
Err(err) => unsafe { super::state().error(err.display_lua_error().as_ref()) }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue