feat(tvix/eval): Box Value::Catchable
This is now the only enum variant for Value that is larger than 8 bytes (it's 16 bytes), so boxing it (especially since it's not perf-critical) allows us to get the Value size down to only 16 bytes! Change-Id: I98598e2b762944448bef982e8ff7da6d6683c4aa Reviewed-on: https://cl.tvl.fyi/c/depot/+/10798 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: aspen <root@gws.fyi>
This commit is contained in:
parent
dd26177319
commit
7e286aab1a
11 changed files with 45 additions and 40 deletions
|
|
@ -61,7 +61,7 @@ impl Value {
|
|||
)
|
||||
.await?
|
||||
{
|
||||
Value::Catchable(cek) => return Ok(Err(cek)),
|
||||
Value::Catchable(cek) => return Ok(Err(*cek)),
|
||||
Value::String(s) => return Ok(Ok(Json::String(s.to_str()?.to_owned()))),
|
||||
_ => panic!("Value::coerce_to_string_() returned a non-string!"),
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ impl Value {
|
|||
Json::Object(out)
|
||||
}
|
||||
|
||||
Value::Catchable(c) => return Ok(Err(c)),
|
||||
Value::Catchable(c) => return Ok(Err(*c)),
|
||||
|
||||
val @ Value::Closure(_)
|
||||
| val @ Value::Thunk(_)
|
||||
|
|
@ -110,7 +110,7 @@ impl Value {
|
|||
/// Value::Json.
|
||||
pub(crate) async fn into_json_generator(self, co: GenCo) -> Result<Value, ErrorKind> {
|
||||
match self.into_json(&co).await? {
|
||||
Err(cek) => Ok(Value::Catchable(cek)),
|
||||
Err(cek) => Ok(Value::from(cek)),
|
||||
Ok(json) => Ok(Value::Json(Box::new(json))),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue