Closed tomaka closed 7 years ago
While it is maybe controversial to modify Push
to return a Result
, let's look at the alternatives:
I'm going to change type Err = ();
into type Err = Void;
where Void
is a non-instantiable type.
The idea now is that set
can still be used for anything except LuaCode
and LuaCodeFromReader
, while the new checked_set
functions can be used with everything and returns a Result
.
This PR allows pushing Lua code.
For example:
You can then do:
Similar to
LuaCode
, also addsLuaCodeFromReader
.This change required modifying the
Push
trait to return aResult
instead, in order to handle syntax errors. More code cleanups will need to be made later. Since the code was quite dirty already, I don't think it's a problem to add even more panicking corner cases.