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
Presently List::from_parts doesn't check that the depth passed in is correct. It is a pub(crate) function and is only intended for internal use where the depth has already been checked. Even so, we could make the API more correct by construction by omitting the depth parameter and deriving it from Self::depth, or by checking the depth and returning an error if it is incorrect. I think the first solution is preferable.
I think the parameter was only passed in as an optimisation to avoid computing it twice, but this is likely a very minor saving.
The text was updated successfully, but these errors were encountered:
A similar consideration applies to the length passed in. It could be incorrect. However checking the length against the tree is expensive, so at most we could check that it is less than the capacity N.
Presently
List::from_parts
doesn't check that thedepth
passed in is correct. It is apub(crate)
function and is only intended for internal use where the depth has already been checked. Even so, we could make the API more correct by construction by omitting thedepth
parameter and deriving it fromSelf::depth
, or by checking the depth and returning an error if it is incorrect. I think the first solution is preferable.I think the parameter was only passed in as an optimisation to avoid computing it twice, but this is likely a very minor saving.
The text was updated successfully, but these errors were encountered: