Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Issue for core::array::(try_)repeat(_with) (feature array_repeat) #91613

Closed
3 tasks
scottmcm opened this issue Dec 7, 2021 · 1 comment
Closed
3 tasks
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@scottmcm
Copy link
Member

scottmcm commented Dec 7, 2021

Feature gate: #![feature(array_repeat)]

This is a tracking issue for creating a fixed-size array by repeatedly Cloning an item, or by repeatedly calling a possibly-fallible nullary FnMut.

Public API

// core::array

pub fn repeat<T: Clone, const N: usize>(value: T) -> [T; N];
pub fn repeat_with<T, const N: usize>(f: impl FnMut() -> T) -> [T; N];
pub fn try_repeat_with<R: Try, const N: usize>(
    f: impl FnMut() -> R,
) -> ChangeOutputType<R, [R::Output; N]>
where
    R::Residual: Residual<[R::Output; N]>;

Steps / History

Unresolved Questions

  • repeat_with and try_repeat_with are very similar to from_fn and try_from_fn (Tracking issue for try_array_from_fn #89379), just that they take nullary instead of unary functions. Anyone considering stabilizing these should think about those, and vice versa.
@scottmcm scottmcm added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC labels Dec 7, 2021
@scottmcm
Copy link
Member Author

Closing since the PR was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant