While going through the codebase, I noticed that Value::as_integer and Value::as_real return Option<&i64> and Option<&f64> respectively, rather than Option and Option.
Since i64 and f64 are both Copy and only 8 bytes (the same size as a reference on a 64-bit target), returning a reference offers no performance benefit and forces every caller to dereference. Is there a specific reason for this, or would a change to return by value be welcome?
For comparison, serde_json::Value::as_i64/as_f64 returns these by value.
While going through the codebase, I noticed that Value::as_integer and Value::as_real return Option<&i64> and Option<&f64> respectively, rather than Option and Option.
Since i64 and f64 are both Copy and only 8 bytes (the same size as a reference on a 64-bit target), returning a reference offers no performance benefit and forces every caller to dereference. Is there a specific reason for this, or would a change to return by value be welcome?
For comparison, serde_json::Value::as_i64/as_f64 returns these by value.