You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, we don't really distinguish between cases where we want to take N bytes from the stream because we might want to borrow the data (e.g. for zero-copy &'de str or &'de [u8] cases), and where we just happen to know we want the next N bytes in the stream (e.g. the current deserializers for f32, f64, and char).
While discussing an "interning flavor" with @cr1901, I realized that the approach I took in this proof of concept would inadvertently intern bytes for the f32/f64/char types as well, even though these only need to be "transient" borrows.
It might be worth it to add a new default trait method, like try_take_n_transient, which defaults to passing through to try_take_n, to allow flavors that care to distinguish between these kinds of takes.
Right now, we don't really distinguish between cases where we want to take N bytes from the stream because we might want to borrow the data (e.g. for zero-copy
&'de str
or&'de [u8]
cases), and where we just happen to know we want the next N bytes in the stream (e.g. the current deserializers forf32
,f64
, andchar
).While discussing an "interning flavor" with @cr1901, I realized that the approach I took in this proof of concept would inadvertently intern bytes for the f32/f64/char types as well, even though these only need to be "transient" borrows.
It might be worth it to add a new default trait method, like
try_take_n_transient
, which defaults to passing through totry_take_n
, to allow flavors that care to distinguish between these kinds oftakes
.Could be relevant to #91.
The text was updated successfully, but these errors were encountered: