Skip to content

Commit 5370448

Browse files
author
Paul Maruhn
committed
ran cargo fmt
1 parent 5bae803 commit 5370448

File tree

16 files changed

+138
-489
lines changed

16 files changed

+138
-489
lines changed

examples/fetch_usercomments.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
extern crate proxer;
2-
use proxer::api::user;
32
use proxer::Client;
3+
use proxer::api::user;
44

55
fn main() {
66
// a very simple straightforward request:
@@ -13,7 +13,6 @@ fn main() {
1313
.unwrap()
1414
.pager(req);
1515

16-
1716
// Thanks to Rust's syntax sugar we can use an ordinary
1817
// `for each` loop to make the request
1918
for entry in pager {
@@ -25,5 +24,4 @@ fn main() {
2524
Ok(r) => println!("{:#?}", r),
2625
}
2726
}
28-
2927
}

src/api/info.rs

+5-69
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ use Pager;
44
use client::Client;
55
use response;
66

7-
8-
9-
10-
11-
127
#[derive(Serialize, Debug, Clone)]
138
pub struct GetFullEntry {
149
pub id: usize,
@@ -20,17 +15,12 @@ impl Endpoint for GetFullEntry {
2015
const URL: &'static str = "info/fullentry";
2116
}
2217

23-
2418
impl GetFullEntry {
2519
pub fn with_default(id: usize) -> Self {
26-
Self {
27-
id: id as usize
28-
}
20+
Self { id: id as usize }
2921
}
3022
}
3123

32-
33-
3424
#[derive(Serialize, Debug, Clone)]
3525
pub struct GetEntry {
3626
pub id: usize,
@@ -44,66 +34,47 @@ impl Endpoint for GetEntry {
4434

4535
impl GetEntry {
4636
pub fn with_default(id: usize) -> Self {
47-
Self {
48-
id: id as usize
49-
}
37+
Self { id: id as usize }
5038
}
5139
}
5240

53-
54-
5541
#[derive(Serialize, Debug, Clone)]
5642
pub struct GetNames {
5743
pub id: usize,
5844
}
5945

60-
61-
6246
#[derive(Serialize, Debug, Clone)]
6347
pub struct GetGate {
6448
pub id: usize,
6549
}
6650

67-
68-
69-
70-
7151
#[derive(Serialize, Debug, Clone)]
7252
pub struct GetLang {
7353
pub id: usize,
7454
}
7555

76-
77-
7856
#[derive(Serialize, Debug, Clone)]
7957
pub struct GetSeason {
8058
pub id: usize,
8159
}
8260

83-
8461
#[derive(Serialize, Debug, Clone)]
8562
pub struct GetGroups {
8663
pub id: usize,
8764
}
8865

89-
90-
9166
#[derive(Serialize, Debug, Clone)]
9267
pub struct GetPublisher {
9368
pub id: usize,
9469
}
9570

96-
97-
9871
#[derive(Serialize, Debug, Clone)]
9972
pub struct GetListinfo {
10073
pub id: usize,
10174
pub p: Option<i64>,
10275
pub limit: Option<i64>,
10376
}
10477

105-
106-
10778
#[derive(Serialize, Debug, Clone)]
10879
pub struct GetComments {
10980
pub id: usize,
@@ -112,83 +83,48 @@ pub struct GetComments {
11283
pub sort: Option<String>,
11384
}
11485

115-
116-
11786
impl Endpoint for GetComments {
11887
type ResponseType = Vec<response::info::Comment>;
11988
#[doc(hidden)]
12089
const URL: &'static str = "info/comments";
12190
}
12291

123-
124-
12592
impl PageableEndpoint for GetComments {
126-
fn pager(self, client: Client) -> Pager<GetComments>
127-
{
93+
fn pager(self, client: Client) -> Pager<GetComments> {
12894
debug!("new pager with data: {:?}", self);
12995
Pager::new(client, self, Some(0), Some(3))
13096
}
13197

132-
fn page_mut(&mut self) -> &mut Option<usize>
133-
{
98+
fn page_mut(&mut self) -> &mut Option<usize> {
13499
&mut self.p
135100
}
136101

137-
fn limit_mut(&mut self) -> &mut Option<usize>
138-
{
102+
fn limit_mut(&mut self) -> &mut Option<usize> {
139103
&mut self.limit
140104
}
141105
}
142106

143-
144-
145-
146-
147-
148-
149-
150-
151-
152-
153-
154-
155-
156-
157-
158-
159-
160107
#[derive(Serialize, Debug, Clone)]
161108
pub struct GetRelations {
162109
pub info_id: usize,
163110
pub is_h: Option<bool>,
164111
}
165112

166-
167-
168113
#[derive(Serialize, Debug, Clone)]
169114
pub struct EntryTags {
170115
pub id: usize,
171116
}
172117

173-
174-
175118
#[derive(Serialize, Debug, Clone)]
176119
pub struct GetTranslatorgroup {
177120
pub id: usize,
178121
}
179122

180-
181-
182123
#[derive(Serialize, Debug, Clone)]
183124
pub struct GetIndustry {
184125
pub id: usize,
185126
}
186127

187-
188-
189-
190-
191-
192128
#[derive(Serialize, Debug, Clone)]
193129
pub struct SetUserInfo {
194130
pub id: usize,

src/api/list.rs

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
use Client;
12
use Endpoint;
23
use PageableEndpoint;
3-
use response::list as response;
44
use Pager;
5-
use Client;
6-
5+
use response::list as response;
76

87
#[derive(Serialize, Debug, Clone)]
98
pub struct GetEntryList {
@@ -17,14 +16,12 @@ pub struct GetEntryList {
1716
pub limit: Option<usize>,
1817
}
1918

20-
2119
impl Endpoint for GetEntryList {
2220
type ResponseType = Vec<response::EntryList>;
2321
#[doc(hidden)]
2422
const URL: &'static str = "list/entrylist";
2523
}
2624

27-
2825
impl PageableEndpoint for GetEntryList {
2926
/// Default pager:
3027
///
@@ -33,25 +30,20 @@ impl PageableEndpoint for GetEntryList {
3330
/// limit = 3500
3431
/// ```
3532
36-
fn pager(self, client: Client) -> Pager<Self>
37-
{
33+
fn pager(self, client: Client) -> Pager<Self> {
3834
debug!("new pager with data: {:?}", self);
3935
Pager::new(client, self, Some(0), Some(3500))
4036
}
4137

42-
fn page_mut(&mut self) -> &mut Option<usize>
43-
{
38+
fn page_mut(&mut self) -> &mut Option<usize> {
4439
&mut self.p
4540
}
4641

47-
fn limit_mut(&mut self) -> &mut Option<usize>
48-
{
42+
fn limit_mut(&mut self) -> &mut Option<usize> {
4943
&mut self.limit
5044
}
5145
}
5246

53-
54-
5547
impl GetEntryList {
5648
/// Creates an instance with everything `None`
5749
pub fn with_default() -> Self {

0 commit comments

Comments
 (0)