You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We already have a ToLua impl for Option, which will push the contained value if it exists, and nil otherwise. This maps pretty well into Lua's world.
Another common Lua pattern occurs when dealing with fallible operations like io.open, which either returns the opened file on success, or nil followed by an error message on failure. It would be nice if I could map Rust's Result to this idiom. This would require a ToLuaMulti impl instead of a ToLua impl, though (since the operation can push niland the error message).
The text was updated successfully, but these errors were encountered:
We already have a
ToLua
impl forOption
, which will push the contained value if it exists, andnil
otherwise. This maps pretty well into Lua's world.Another common Lua pattern occurs when dealing with fallible operations like
io.open
, which either returns the opened file on success, ornil
followed by an error message on failure. It would be nice if I could map Rust'sResult
to this idiom. This would require aToLuaMulti
impl instead of aToLua
impl, though (since the operation can pushnil
and the error message).The text was updated successfully, but these errors were encountered: