mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Update CODE_STYLE.md
This commit is contained in:
parent
28c5d9f8c2
commit
2f086daf8e
1 changed files with 24 additions and 0 deletions
|
@ -42,6 +42,30 @@ Good:
|
||||||
pub fn make_request(url: &str) -> String { ... }
|
pub fn make_request(url: &str) -> String { ... }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Also, link resources in your comments when possible:
|
||||||
|
|
||||||
|
```rust
|
||||||
|
/// Download a file from Telegram.
|
||||||
|
///
|
||||||
|
/// `path` can be obtained from the [`Bot::get_file`].
|
||||||
|
///
|
||||||
|
/// To download into [`AsyncWrite`] (e.g. [`tokio::fs::File`]), see
|
||||||
|
/// [`Bot::download_file`].
|
||||||
|
///
|
||||||
|
/// [`Bot::get_file`]: crate::bot::Bot::get_file
|
||||||
|
/// [`AsyncWrite`]: tokio::io::AsyncWrite
|
||||||
|
/// [`tokio::fs::File`]: tokio::fs::File
|
||||||
|
/// [`Bot::download_file`]: crate::Bot::download_file
|
||||||
|
#[cfg(feature = "unstable-stream")]
|
||||||
|
pub async fn download_file_stream(
|
||||||
|
&self,
|
||||||
|
path: &str,
|
||||||
|
) -> Result<impl Stream<Item = Result<Bytes, reqwest::Error>>, reqwest::Error>
|
||||||
|
{
|
||||||
|
download_file_stream(&self.client, &self.token, path).await
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Use Self where possible
|
## Use Self where possible
|
||||||
Bad:
|
Bad:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue