pub struct ProviderRequest {
pub url: String,
pub headers: Vec<(Cow<'static, str>, Cow<'static, str>)>,
pub body: Value,
pub timeout: Option<Duration>,
}Expand description
Opaque provider-specific request.
This type encapsulates all information needed to make an HTTP request to a provider, without committing to a specific HTTP client library.
Headers use Cow<'static, str> to avoid allocations for common headers.
Fields§
§url: StringFull URL to send request to
headers: Vec<(Cow<'static, str>, Cow<'static, str>)>HTTP headers (name, value pairs) using Cow to avoid allocations for static strings
body: ValueRequest body (JSON)
timeout: Option<Duration>Optional request timeout override
Implementations§
Source§impl ProviderRequest
impl ProviderRequest
Sourcepub fn new(url: impl Into<String>) -> ProviderRequest
pub fn new(url: impl Into<String>) -> ProviderRequest
Create a new provider request.
Sourcepub fn with_header(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> ProviderRequest
pub fn with_header( self, name: impl Into<String>, value: impl Into<String>, ) -> ProviderRequest
Add a header with owned strings.
Sourcepub fn with_static_header(
self,
name: &'static str,
value: &'static str,
) -> ProviderRequest
pub fn with_static_header( self, name: &'static str, value: &'static str, ) -> ProviderRequest
Add a header with static strings (zero allocation).
Sourcepub fn with_body(self, body: Value) -> ProviderRequest
pub fn with_body(self, body: Value) -> ProviderRequest
Set the body.
Sourcepub fn with_timeout(self, timeout: Duration) -> ProviderRequest
pub fn with_timeout(self, timeout: Duration) -> ProviderRequest
Set the timeout.
Trait Implementations§
Source§impl Clone for ProviderRequest
impl Clone for ProviderRequest
Source§fn clone(&self) -> ProviderRequest
fn clone(&self) -> ProviderRequest
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 ProviderRequest
impl Debug for ProviderRequest
Source§impl<'de> Deserialize<'de> for ProviderRequest
impl<'de> Deserialize<'de> for ProviderRequest
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ProviderRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ProviderRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ProviderRequest
impl PartialEq for ProviderRequest
Source§impl Serialize for ProviderRequest
impl Serialize for ProviderRequest
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ProviderRequest
Auto Trait Implementations§
impl Freeze for ProviderRequest
impl RefUnwindSafe for ProviderRequest
impl Send for ProviderRequest
impl Sync for ProviderRequest
impl Unpin for ProviderRequest
impl UnwindSafe for ProviderRequest
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