api-guidelines icon indicating copy to clipboard operation
api-guidelines copied to clipboard

Rust API guidelines

Results 39 api-guidelines issues
Sort by recently updated
recently updated
newest added

As MIT still require attribution, by preserving the license statement, it isn't the most permissible license possible, hence why 0BSD and MIT-0 licenses have arisen, for those who want to...

The canonical Debug implementation for **any** type that implements Deref is: ```rust Debug::fmt(&**self, formatter) ``` This principle came up during libs team discussion of https://github.com/rust-lang/rust/pull/48553.

amendment
T-libs
disposition-merge
needs-fcp
finished-final-comment-period

https://github.com/rust-lang-nursery/api-guidelines/issues/135#issuecomment-343698387 suggests a nice one: > I've been using `PascalCase!` for macros that expand into types. (e.g. `Array![i32; 5; 4; 3]` which expands into `[[[i32; 3]; 4]; 5]`) I did...

amendment
T-libs
disposition-merge
needs-fcp
finished-final-comment-period

This PR tries to codify what's being brought up in this forum thread: https://users.rust-lang.org/t/do-people-not-care-about-printable-error-chains-a-k-a-how-to-nicely-implement-display-for-an-error/35362 These guidelines are still lacking a lot of information about how to design error types well...

amendment
2021

C-ITER recommends implementing three methods for collections: `iter()`, `iter_mut()` and `into_iter()`. It fails to mention that `into_iter()` can (and probably should?) be implemented by implementing the `IntoIterator` trait. Additionally, the...

amendment
accepted
I-nominated

According to the [rustdoc book](https://doc.rust-lang.org/rustdoc/documentation-tests.html#using--in-doc-tests): > As of version 1.34.0, one can also omit the fn main(), but you will have to disambiguate the error type: > > ```rust >...

presentation
accepted

The C-STRUCT-PRIVATE recommendation talks about a single struct field being public or private. It does not mention what happens when all fields of a struct are public, e.g., in that...

amendment
accepted

https://github.com/rust-lang/rfcs/pull/1860#issuecomment-279848322 gives an interesting reason to consider not following the C-SMART-PTR guideline. In that case we decided to follow the guideline anyway, even though the motivation for the guideline does...

clarification
amendment
accepted

Can we expand the language of C-COMMON-TRAITS to help making decisions for enum types implementing non-trivial traits, specially `Ord`/`PartialOrd` and `Default`? I think the question I face in designing the...

clarification
amendment
I-nominated

[C-NEWTYPE-HIDE](https://rust-lang-nursery.github.io/api-guidelines/future-proofing.html#newtypes-encapsulate-implementation-details-c-newtype-hide) neglects to mention something that I feel is quite important: `Enumerate` does not just implement `Iterator`; it may also implement some or all of `Debug`, `Clone`, `FusedIterator`, `ExactSizeIterator` and...

amendment
accepted