-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
I just tried to use these in my own code and was kind of shocked they didn't exist.
Justification: this seems like a common Rust pattern. We have is_some
and is_none
for Option
, is_ok
and is_err
for Result
, etc., so, it seems pretty fair to have is_borrowed
and is_owned
for Cow
.
Having as_borrowed
and as_owned
wouldn't really make much sense, as a simple &
and &mut/to_mut
cover those use cases. But, these check functions are pretty useful on their own.
crlf0710, DutchGhost, Luro02, Timmmm, Kerollmops and 36 moreGKFXdenisandroid, George-Miao, schneiderfelipe, Stumblinbear, iago-lito and 3 more
Metadata
Metadata
Assignees
Labels
B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.