Because trait objects can't have sizes known at compile-time, calls to Buffer.marshall must return a Box<Value>. This results in overhead from heap allocation. For common operations Value.function(value) it may be optimal to add a corresponding Buffer.function(value) which takes care both of marshaling self and performing the operation. So the syntax would look like
buffer.compare(value);
instead of
let marshalled: Box<Value> = buffer.marshall();
marshalled.compare(value);
Because trait objects can't have sizes known at compile-time, calls to
Buffer.marshall
must return aBox<Value>
. This results in overhead from heap allocation. For common operationsValue.function(value)
it may be optimal to add a correspondingBuffer.function(value)
which takes care both of marshalingself
and performing the operation. So the syntax would look likeinstead of