Feature Name: async_closure1 2 Start Date: 2024-06-25 RFC PR: rust-lang/rfcs#3668 Tracking Issue: rust-lang/rust#62290 Summary This RFC adds an async bound modifier to the Fn family of trait bounds. The combination currently desugars to a s...
Feature Name: unprefixed_guarded_strings Start Date: 2024-03-24 RFC PR: rust-lang/rfcs#3593 Tracking Issue: rust-lang/rust#123735 Summary Beginning with the 2024 edition, reserve the syntax #"foo"#, as a way of future-proofing against futur...
Feature Name: cfg_boolean_literals Start Date: 2024-09-16 RFC PR: rust-lang/rfcs#3695 Tracking Issue: rust-lang/rust#131204 Summary Allow true and false boolean literals as cfg predicates, i.e. cfg(true)/cfg(false). Motivation Often, we may...
Feature Name: new_range Start Date: 2023-12-18 RFC PR: rust-lang/rfcs#3550 Tracking Issue: rust-lang/rust#123741 Summary Change the range operators a..b, a.., and a..=b to resolve to new types std::range::Range, std::range::RangeFrom, and s...
Feature Name: associated_type_bounds Start Date: 2018-01-13 RFC PR: rust-lang/rfcs#2289 Rust Issue: rust-lang/rust#52662 Summary Introduce the bound form MyTrait<AssociatedType: Bounds>, permitted anywhere a bound of the form MyTrait<Associ...
Feature Name: N/A Start Date: 2022-01-19 RFC PR: rust-lang/rfcs#3373 Tracking Issue: rust-lang/rust#120363 Summary Add a warn-by-default lint for items inside functions or expressions that implement methods or traits that are visible outsid...
Rust API Guidelines This is a set of recommendations on how to design and present APIs for the Rust programming language. They are authored largely by the Rust library team, based on experiences building the Rust standard library and other...
Rust API Guidelines Checklist • Naming (crate aligns with Rust naming conventions) • [ ] Casing conforms to RFC 430 (C-CASE) • [ ] Ad-hoc conversions follow as_, to_, into_ conventions (C-CONV) • [ ] Getter names follow Rust convention (C-G...
Naming Casing conforms to RFC 430 (C-CASE) Basic Rust naming conventions are described in RFC 430. In general, Rust tends to use UpperCamelCase for "type-level" constructs (types and traits) and snake_case for "value-level" constructs. More...
Interoperability Types eagerly implement common traits (C-COMMON-TRAITS) Rust's trait system does not allow orphans: roughly, every impl must live either in the crate that defines the trait or the implementing type. Consequently, crates tha...
Macros Input syntax is evocative of the output (C-EVOCATIVE) Rust macros let you dream up practically whatever input syntax you want. Aim to keep input syntax familiar and cohesive with the rest of your users' code by mirroring existing Rus...
Documentation Crate level docs are thorough and include examples (C-CRATE-DOC) See RFC 1687. All items have a rustdoc example (C-EXAMPLE) Every public module, trait, struct, enum, function, method, macro, and type definition should have an...
Predictability Smart pointers do not add inherent methods (C-SMART-PTR) For example, this is why the Box::into_raw function is defined the way it is. impl<T> Box<T> where T: ?Sized { fn into_raw(b: Box<T>) -> *mut T { /* ... */ } } let boxe...
Flexibility Functions expose intermediate results to avoid duplicate work (C-INTERMEDIATE) Many functions that answer a question also compute interesting related data. If this data is potentially of interest to the client, consider exposing...
Type safety Newtypes provide static distinctions (C-NEWTYPE) Newtypes can statically distinguish between different interpretations of an underlying type. For example, a f64 value might be used to represent a quantity in miles or in kilomete...
Dependability Functions validate their arguments (C-VALIDATE) Rust APIs do not generally follow the robustness principle: "be conservative in what you send; be liberal in what you accept". Instead, Rust code should enforce the validity of i...
Debuggability All public types implement Debug (C-DEBUG) If there are exceptions, they are rare. Debug representation is never empty (C-DEBUG-NONEMPTY) Even for conceptually empty values, the Debug representation should never be empty. let...
Future proofing Sealed traits protect against downstream implementations (C-SEALED) Some traits are only meant to be implemented within the crate that defines them. In such cases, we can retain the ability to make changes to the trait in a...
Necessities Public dependencies of a stable crate are stable (C-STABLE) A crate cannot be stable (>=1.0.0) without all of its public dependencies being stable. Public dependencies are crates from which types are used in the public API of th...
External links • RFC 199 - Ownership naming conventions • RFC 344 - Naming conventions • RFC 430 - Naming conventions • RFC 505 - Doc conventions • RFC 1574 - Doc conventions • RFC 1687 - Crate-level documentation • Elegant Library APIs in...