rhg: in path_encode, split Dest into VecDest and MeasureDest
Two separate types make the write semantics easier to understand
because we can consider the two sinks separately.
Having two independent compiled functions for size measurement
and for actual encoding seems likely to improve performance, too.
(and maybe we should get rid of measurement altogether)
Getting rid of [Dest] also removes the ugly option rewrapping
code, which is good.
rhg: use generic DestArr in hash_mangle
This simplifies code a bit more, but comes with an extra memory copy
in case [destlen == dest_vec.len()].
This is probably fine, but a follow-up change is removing that too.
rhg: in path_encode add a DestArr type
This is an implementation of Sink trait that writes into a fixed-size
buffer on the stack, so identical to what was done before, but
it makes the code of [hash_encode] easier to understand by dropping
all these slice manipulations.
rhg: reduce verbosity in path_encode by using a trait for writing
Hopefully this makes the code easier to read and understand and
shorter overall.
It also lets us later tweak the type we use as a [Sink],
without having to change the encoding functions, including using
two different types for size measurement and for the actual
serialization.
refactor: simplify code in rust version of path_encode
Moving the addition of '/' separator to the end of the loop makes the rest
of the logic much simpler because the first iteration is no longer special.
dirstate: phase-divergent update to
4e95341c89aa
Heptapod published the obsolete version of those.
dirstate: phase-divergent update to
65943224c184
Heptapod published the obsolete version of those.