pub struct HeadwatersConfig { /* private fields */ }Expand description
How a HeadwatersClient reaches the server.
Build one with HeadwatersConfig::new (then the with_* setters) or
HeadwatersConfig::from_env.
Implementations§
Source§impl HeadwatersConfig
impl HeadwatersConfig
Sourcepub fn new(base_url: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>) -> Self
Start from a base URL (e.g. http://localhost:8091), default timeout, no auth.
Sourcepub fn from_env() -> Result<Self, Error>
pub fn from_env() -> Result<Self, Error>
Read configuration from the environment:
HEADWATERS_URL (required), HEADWATERS_TOKEN and HEADWATERS_TIMEOUT_MS
(optional). A non-numeric HEADWATERS_TIMEOUT_MS is ignored.
Sourcepub fn with_token(self, token: impl Into<String>) -> Self
pub fn with_token(self, token: impl Into<String>) -> Self
Set a bearer token, sent as authorization: Bearer <token>.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set the per-request timeout.
Trait Implementations§
Source§impl Clone for HeadwatersConfig
impl Clone for HeadwatersConfig
Source§fn clone(&self) -> HeadwatersConfig
fn clone(&self) -> HeadwatersConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HeadwatersConfig
impl RefUnwindSafe for HeadwatersConfig
impl Send for HeadwatersConfig
impl Sync for HeadwatersConfig
impl Unpin for HeadwatersConfig
impl UnsafeUnpin for HeadwatersConfig
impl UnwindSafe for HeadwatersConfig
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