Create CODE_STYLE.md

Related to https://github.com/teloxide/teloxide/issues/55.
This commit is contained in:
Temirkhan Myrzamadi 2019-12-09 20:41:19 +06:00 committed by GitHub
parent 586d7eced7
commit 7444d016f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

26
CODE_STYLE.md Normal file
View file

@ -0,0 +1,26 @@
# Code style
This is a description of a coding style that every contributor must follow. Please, read the whole document before you start pushing code.
## Generics
Generics are always written with `where`.
Bad:
```rust
pub fn new<N: Into<String>,
T: Into<String>,
P: Into<InputFile>,
E: Into<String>>
(user_id: i32, name: N, title: T, png_sticker: P, emojis: E) -> Self { ... }
```
Good:
```rust
pub fn new<N, T, P, E>(user_id: i32, name: N, title: T, png_sticker: P, emojis: E) -> Self
where
N: Into<String>,
T: Into<String>,
P: Into<InputFile>,
E: Into<String> { ... }
```