pub struct BetfairCredential { /* private fields */ }Expand description
Betfair API credentials for session-token authentication.
Betfair uses username/password login to obtain a session token,
which is then passed as X-Authentication on subsequent requests.
The app_key identifies the application and is sent as X-Application.
Secrets are automatically zeroized on drop for security.
Implementations§
Source§impl BetfairCredential
impl BetfairCredential
Sourcepub fn new(username: String, password: String, app_key: String) -> Self
pub fn new(username: String, password: String, app_key: String) -> Self
Creates a new BetfairCredential instance.
Sourcepub fn from_env() -> Option<Self>
pub fn from_env() -> Option<Self>
Load credentials from environment variables.
Reads BETFAIR_USERNAME, BETFAIR_PASSWORD, and BETFAIR_APP_KEY.
Returns None if any variable is not set.
Sourcepub fn resolve(
username: Option<String>,
password: Option<String>,
app_key: Option<String>,
) -> Result<Option<Self>, CredentialError>
pub fn resolve( username: Option<String>, password: Option<String>, app_key: Option<String>, ) -> Result<Option<Self>, CredentialError>
Resolves credentials from provided values or environment.
If all three values are provided, uses those directly. If none are provided, falls back to environment variables.
§Errors
Returns an error if credentials are partially provided.
Trait Implementations§
Source§impl Clone for BetfairCredential
impl Clone for BetfairCredential
Source§fn clone(&self) -> BetfairCredential
fn clone(&self) -> BetfairCredential
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BetfairCredential
impl Debug for BetfairCredential
Auto Trait Implementations§
impl Freeze for BetfairCredential
impl RefUnwindSafe for BetfairCredential
impl Send for BetfairCredential
impl Sync for BetfairCredential
impl Unpin for BetfairCredential
impl UnsafeUnpin for BetfairCredential
impl UnwindSafe for BetfairCredential
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more