#[non_exhaustive]pub struct ConfigBuilder { /* private fields */ }
Expand description
Convenience builder for Config
.
This requires from you to set the API key (ConfigBuilder::new
), but also
makes it possible to set a reqwest
http client with your custom configuration
(see also Resend::with_client
) as well as an override for the Resend’s
base url to send requests to.
let http_client = reqwest::Client::builder()
.timeout(std::time::Duration::from_secs(10))
.build()
.unwrap();
// Make sure to not store secrets in code, instead consider using crates like `dotenvy`
// or `secrecy`.
let _config = ConfigBuilder::new("re_...")
// this can be your proxy's url (if any) or a test server url which
// is intercepting request and allows to inspect them later on
.base_url("http://wiremock:35353".parse().unwrap())
.client(http_client)
.build();
Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
Sourcepub fn new<S>(api_key: S) -> Self
pub fn new<S>(api_key: S) -> Self
Create new ConfigBuilder
with api_key
set.
Sourcepub fn base_url(self, url: Url) -> Self
pub fn base_url(self, url: Url) -> Self
Set a custom Resend’s base url.
This can be your proxy’s url (if any) or a test server url which intercepting request and allows to inspect them later on.
If not provided here, the RESEND_BASE_URL
environment variable will be
used. If that is not not provided either - a default url will be used.
Trait Implementations§
Source§impl Clone for ConfigBuilder
impl Clone for ConfigBuilder
Source§fn clone(&self) -> ConfigBuilder
fn clone(&self) -> ConfigBuilder
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 moreAuto Trait Implementations§
impl Freeze for ConfigBuilder
impl !RefUnwindSafe for ConfigBuilder
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl !UnwindSafe for ConfigBuilder
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