Proposal: Add a .pick(val) Method to Collection Types Hello Rust community, I'd like to propose (or at least start a conversation around) the addition of a .pick(val) method to standard collection types like Vec, HashSet, and HashMap. What .pick(val) Would Do This method would search for a given value (or key), and: Return it if found Panic if not found Example (on Vec): let nums = vec![1, 2, 3]; let x = nums.pick(2); // returns 2 let y = nums.pick(4); // panics: "Value not f...| Rust Internals
Summary Add a built-in #[derive(Error)] macro to std::error, inspired by thiserror, to reduce boilerplate for custom error types. Motivation Most Rust projects need custom errors, but implementing std::error::Error, Display and From is verbose. thiserror solves this elegantly, but adds a dependency and cannot be used in all environments. Example #[derive(Error, Debug)] enum MyError { #[error("not found")] NotFound, #[error("IO error")] Io(#[from] std::io::Error), }| Rust Internals