Skip to content

Commit 3f4b1fb

Browse files
committed
fix: docs
1 parent 1c4e45c commit 3f4b1fb

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ keywords = ["qbit", "qBittorrent", "web", "api", "torrent"]
1313
categories = ["network-programming"]
1414

1515
[package.metadata.docs.rs]
16-
all-features = true
16+
all-features = false
1717
rustdoc-args = ["--cfg", "docsrs"]
1818

1919
[features]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ let torrents = api.get_version().await;
5050

5151
## HTTP Client
5252

53-
The crate by default uses `reqwest` as the HTTP client. It also supports [`cyper`](https://github.com/compio-rs/cyper) (HTTP client for [`compio`](https://github.com/compio-rs/compio) based on hyper) under the `cyper` feature flag. To uses it, disable default features and enable `cyper`:
53+
The crate by default uses `reqwest` as the HTTP client. It also supports [`cyper`](https://github.com/compio-rs/cyper) (HTTP client for [`compio`](https://github.com/compio-rs/compio) based on hyper) under the `cyper` feature flag. To use it, disable default features and enable `cyper`:
5454

5555
```bash
5656
cargo add qbit-rs --no-default-features --features cyper

src/builder.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ impl IntoLoginState for Credential {
3030
}
3131

3232
impl QbitBuilder {
33+
/// Creates a new `QbitBuilder` with default values.
3334
pub fn new() -> Self {
3435
QbitBuilder {
3536
credential: (),
@@ -46,6 +47,12 @@ impl Default for QbitBuilder {
4647
}
4748

4849
impl<C, R, E> QbitBuilder<C, R, E> {
50+
/// Sets the HTTP client for the `Qbit` instance.
51+
///
52+
/// - When `reqwest` feature is enabled (by default), this method accepts a
53+
/// `reqwest::Client`.
54+
/// - When `cyper` feature is enabled, this method accepts a
55+
/// `cyper::Client`.
4956
pub fn client(self, client: Client) -> QbitBuilder<C, Client, E> {
5057
QbitBuilder {
5158
credential: self.credential,
@@ -54,6 +61,11 @@ impl<C, R, E> QbitBuilder<C, R, E> {
5461
}
5562
}
5663

64+
/// Sets the cookie for authentication.
65+
///
66+
/// Note that if you have already set the credential, this method will
67+
/// overwrite the credential and use the cookie instead. The builder
68+
/// will use the latest provided credential for authentication.
5769
#[allow(private_interfaces)]
5870
pub fn cookie(self, cookie: impl Into<String>) -> QbitBuilder<Cookie, R, E> {
5971
QbitBuilder {
@@ -63,6 +75,11 @@ impl<C, R, E> QbitBuilder<C, R, E> {
6375
}
6476
}
6577

78+
/// Sets the username-password credentials for authentication.
79+
///
80+
/// Note that if you have already set the cookie, this method will overwrite
81+
/// the cookie and use the credential instead. The builder will use the
82+
/// latest provided credential for authentication.
6683
pub fn credential(self, credential: Credential) -> QbitBuilder<Credential, R, E> {
6784
QbitBuilder {
6885
credential,
@@ -71,6 +88,7 @@ impl<C, R, E> QbitBuilder<C, R, E> {
7188
}
7289
}
7390

91+
/// Sets the endpoint URL for the qBittorrent Web API.
7492
pub fn endpoint<U>(self, endpoint: U) -> QbitBuilder<C, R, U>
7593
where
7694
U: TryInto<Url>,
@@ -89,6 +107,8 @@ where
89107
U: TryInto<Url>,
90108
U::Error: Debug,
91109
{
110+
/// Builds the `Qbit` instance with the provided configuration and HTTP
111+
/// Client.
92112
pub fn build(self) -> Qbit {
93113
let endpoint = self.endpoint.try_into().expect("Invalid endpoint");
94114
let state = self.credential.into_login_state().pipe(Mutex::new);
@@ -107,6 +127,8 @@ where
107127
U: TryInto<Url>,
108128
U::Error: Debug,
109129
{
130+
/// Builds the `Qbit` instance with the provided configuration and a default
131+
/// HTTP Client.
110132
pub fn build(self) -> Qbit {
111133
self.client(Client::new()).build()
112134
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![doc = include_str!("../README.md")]
2-
#![warn(clippy::future_not_send)]
32
#![cfg_attr(docsrs, feature(doc_cfg))]
3+
#![deny(rustdoc::broken_intra_doc_links)]
44

55
use std::{
66
borrow::Borrow,

0 commit comments

Comments
 (0)