Skip to content

Request: map_ok equivalent for Options/map_some #1081

@dialectician4

Description

@dialectician4

map_ok has been excellent for mapping over Result::Ok's in an iter. I've recently been working on an iter chain which hits an Option at a certain point leading to:

.map(...)
.map(|opt_t1| opt_t1.map(|t1| {
...
}))
.map(|opt_t2| opt_t2.map(|t2| {
...
}))

Since map_ok exists for results, I thought an equivalent map_some would be very useful to get the equivalent code:

.map(...)
.map_some(|t1| ...)
.map_some(|t2| ...)

If this seems reasonable, I'd be very happy to raise a PR to implement!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions