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 #138068: Add Result::map_or_default and Option::map_or_default #138099

Open
3 tasks
fpervaiz opened this issue Mar 6, 2025 · 0 comments
Open
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

@fpervaiz
Copy link

fpervaiz commented Mar 6, 2025

Feature gate: #![feature("result_option_map_or_default")]

This is a tracking issue for adding Result::map_or_default() and Option::map_or_default(). Open RFC rust-lang/rfcs#3148

Public API

// core::result

impl<T, E> Result<T, E> {
    pub fn map_or_default<U, F>(self, f: F) -> U
    where
        U: Default,
        F: FnOnce(T) -> U { .. }
}
// core::result

impl<T> Option<T> {
    pub fn map_or_default<U, F>(self, f: F) -> U
    where
        U: Default,
        F: FnOnce(T) -> U { .. }
}

Steps / History

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@fpervaiz fpervaiz added 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. labels Mar 6, 2025
@fpervaiz fpervaiz changed the title Tracking Issue for #138068: Add Result::map_or_default and Option::map_or_default Tracking Issue for #138068: Add Result::map_or_default and Option::map_or_default Mar 6, 2025
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