This PR replaces a pervasive Deref bound on containers with index and len methods, and reworks copy_slice into copy_range. Now that I type it, we could probably keep copy_slice, as implementing it is not hard (rather dereferencing to form the input slice).
Ideally we would use std::ops::Index but this makes life terrible when we elsewhere write container[..] or the like to get a slice, and instead run afoul of .. not being a usize for the Index implementation. Perhaps this could be cleaned up and made more pleasant before landing.
This PR replaces a pervasive
Deref
bound on containers withindex
andlen
methods, and reworkscopy_slice
intocopy_range
. Now that I type it, we could probably keepcopy_slice
, as implementing it is not hard (rather dereferencing to form the input slice).Ideally we would use
std::ops::Index
but this makes life terrible when we elsewhere writecontainer[..]
or the like to get a slice, and instead run afoul of..
not being ausize
for theIndex
implementation. Perhaps this could be cleaned up and made more pleasant before landing.cc: @antiguru