Closed Totodore closed 2 months ago
Implementing ExactSizeIterator
seems reasonable. I would prefer to avoid making Params
indexable by usize
to allow, for example, switching the underlying representation to be HashMap<&str, &str>
without a breaking change.
Knowing the exact remaining length of the iterator would be nice in my use case, I'm deserializing params to T with serde and I need to keep track of the remaining length.
Because
ParamsIter
only wraps anstd::slice::Iter
, and that it already implementsExactSizeIterator
we just have to forward the call to the innerIter
.Another way to solve my issue would have been to directly use
Params
but I cannot access any elements because it doesn't implementIndex
.What is your opinion on this @ibraheemdev? If you are ok with any of these two solution I will be happy to implement them.