Working on a pet project, I found myself writing some utility on base types, like:
on Option: if_present<F>(self, value_handler: F) where F: FnOnce(T) -> ()
on Vec: if_empty<F>(&self, f: F) where F: FnOnce()
Maybe this is something that can be added to the Rust language.
Being new to Rust, I still do not know whether the RFC process is required or not for such a thing.
Or even if this kind of addition is something the community is interrested in.
Most likely no, minor API additions to existing structures don’t generally need an RFC. However, I don’t think either of those method would be accepted today – both seem like they’re fairly simple (and more readably) implemented in code today.
if_present: if let Some(value) = option { ... }
if_empty: if vec.is_empty() { ... }
In general though API additions can be proposed in a PR and they’ll be reviewed and declined/accepted, or a thread on internals or an issue on rust-lang/rust can be opened asking for thoughts.