pub struct AdsBuilder { /* private fields */ }
Expand description
Implementations§
Source§impl AdsBuilder
impl AdsBuilder
Sourcepub fn new(token: &str) -> Self
pub fn new(token: &str) -> Self
Constructs a new AdsBuilder
.
This is the same as Ads::builder
.
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Constructs a new AdsBuilder
, loading the API token from either
environment valiables or the user’s home directory.
The following locations are checked, in the listed order:
- The
ADS_API_TOKEN
environment variable, - The
ADS_DEV_KEY
environment variable, - The contents of the
~/.ads/token
file, and - The contents of the
~/.ads/dev_key
file.
These were chosen to be compatible with the locations supported by the
Python client ads
.
§Errors
This method fails when the token cannot be loaded from any of the expected locations.
Sourcepub fn user_agent(self, user_agent: &str) -> Self
pub fn user_agent(self, user_agent: &str) -> Self
Sets the User-Agent
header to be used by this client.
Auto Trait Implementations§
impl Freeze for AdsBuilder
impl RefUnwindSafe for AdsBuilder
impl Send for AdsBuilder
impl Sync for AdsBuilder
impl Unpin for AdsBuilder
impl UnwindSafe for AdsBuilder
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