[Reasoning] A valid const-generic impl Default for arrays, and eventually working to a TryFromIter implementation... #71514
Labels
A-const-generics
Area: const generics (parameters and arguments)
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
This is mostly an ideas test for potentially introducing a generic impl for Default over an array of any size, rather than just up to 32.
My current implementation does not, unfortunately, implement default for arrays at zero cost; but could be useful for further checks:
Unfortunately I believe this currently is an erroneous implementation, and has other issues regarding the real cost of it.
This could also be implemented in a less technical way if
FromIterator
on arrays stabilises, or rather aTryFromIterator
implementation detailed below arises (note thetry_collect
)Or the original code could be a part of a generic implementation of
FromIterator
, or a potential traitTryFromIterator
where type Error is of typeTryFromSliceError
, or a similarly zero-sizedTryFromIteratorError
; and a further is added:... I thank you for your time.
p.s: I also should really stop writing these so early... and need to adopt more official language in this circumstance. If someone can write this up as a feature request or PR more officially, that'd be amazing. Thank you.
The text was updated successfully, but these errors were encountered: