-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust Client::issue to accept request input via reference
The Client::issue method takes ownership of the input parameters to use for the request to issue. That, however, is actually unnecessary: none of the internals actually require ownership of this data. As such, this change adjusts the signature of the method to accept the request input via a reference, eliminating the need to clone or otherwise duplicate requests in certain client code.
- Loading branch information
Showing
17 changed files
with
86 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (C) 2020 Daniel Mueller <[email protected]> | ||
// Copyright (C) 2020-2021 Daniel Mueller <[email protected]> | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
use apca::api::v2::order; | ||
|
@@ -29,6 +29,6 @@ async fn main() { | |
// We want to go long on AAPL, buying a single share. | ||
.init("AAPL", order::Side::Buy, 1); | ||
|
||
let order = client.issue::<order::Post>(request).await.unwrap(); | ||
let order = client.issue::<order::Post>(&request).await.unwrap(); | ||
println!("Created order {}", order.id.to_hyphenated_ref()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (C) 2019-2020 Daniel Mueller <[email protected]> | ||
// Copyright (C) 2019-2021 Daniel Mueller <[email protected]> | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
use std::fmt::Display; | ||
|
@@ -454,7 +454,7 @@ mod tests { | |
async fn test(symbol: Symbol) { | ||
let api_info = ApiInfo::from_env().unwrap(); | ||
let client = Client::new(api_info); | ||
let asset = client.issue::<Get>(symbol).await.unwrap(); | ||
let asset = client.issue::<Get>(&symbol).await.unwrap(); | ||
|
||
// The AAPL asset ID, retrieved out-of-band. | ||
let id = Id(Uuid::parse_str("b0b6dd9d-8b9b-48a9-ba46-b9d54906e415").unwrap()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (C) 2019-2020 Daniel Mueller <[email protected]> | ||
// Copyright (C) 2019-2021 Daniel Mueller <[email protected]> | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
use std::time::SystemTime; | ||
|
@@ -76,7 +76,7 @@ mod tests { | |
|
||
let api_info = ApiInfo::from_env().unwrap(); | ||
let client = Client::new(api_info); | ||
let clock = client.issue::<Get>(()).await.unwrap(); | ||
let clock = client.issue::<Get>(&()).await.unwrap(); | ||
|
||
// We want to sanitize the current time being reported at least to a | ||
// certain degree. For that we assume that our local time is | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.