This PR adds a variable to the environment that tracks whether the currently evaluated expression's output should be printed directly or stored in a string. This is done to allow things like let x = which vim or "[" + (hostname ()) + "]".
I also refactored some parts to clone objects less often, allocate fewer Boxes and Vecs and use .to_string() instead of format!("{}", ..) when possible.
I replaced occurrences of impl ToString with impl Into<String> or just String, because ToString uses the Display implementation which might be more expensive.
Fixes #71. Closes #70.
This PR adds a variable to the environment that tracks whether the currently evaluated expression's output should be printed directly or stored in a string. This is done to allow things like
let x = which vim
or"[" + (hostname ()) + "]"
.I also refactored some parts to clone objects less often, allocate fewer
Box
es andVec
s and use.to_string()
instead offormat!("{}", ..)
when possible.I replaced occurrences of
impl ToString
withimpl Into<String>
or justString
, becauseToString
uses theDisplay
implementation which might be more expensive.