aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Edgecumbe <git@esotericnonsense.com>2019-10-27 22:00:03 +0100
committerDaniel Edgecumbe <git@esotericnonsense.com>2019-10-27 22:00:03 +0100
commitc5bd939539304241df65b95bed714e076b7bcc12 (patch)
tree890fc7543a26f5bfdfff62cac2d993a0b05bf66c
parentfa0b198ae675ff440ddc4028b84fdc937f932b4c (diff)
BFClient::new returns bare BFClient; users may wrap in Arc if desired
-rw-r--r--src/client.rs6
-rw-r--r--src/lib.rs6
2 files changed, 7 insertions, 5 deletions
diff --git a/src/client.rs b/src/client.rs
index 81ea7e2..68a3790 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -96,7 +96,7 @@ impl BFClient {
pub fn new(
creds: BFCredentials,
proxy_uri: Option<String>,
- ) -> Result<Arc<Self>> {
+ ) -> Result<Self> {
let client: reqwest::Client = match &proxy_uri {
Some(uri) => {
let proxy = reqwest::Proxy::all(uri)?;
@@ -117,13 +117,13 @@ impl BFClient {
tx
};
- Ok(Arc::new(BFClient {
+ Ok(BFClient {
client,
destructor,
session_token,
creds,
proxy_uri,
- }))
+ })
}
/// This function is run once per BFClient as a thread. It ensures that the
diff --git a/src/lib.rs b/src/lib.rs
index 6423a84..16c82fa 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -17,8 +17,10 @@
//! # botfair
//!
//! The `botfair` crate provides Rust bindings for the Betfair SportsAPING.
-//! Automatic login.
-//! Coming soon: automatic keep-alive.
+//! Login and keep-alive are handled automatically by the BFClient.
+//!
+//! The BFClient class implements Sync and so can safely be wrapped in an Arc
+//! for multithreaded use with the same session token.
//!
//! ## Example
//! Note that `botfair` requires your certificate to be in `pfx` format.