pub struct RequestBuilder { /* private fields */ }Implementations§
Source§impl RequestBuilder
impl RequestBuilder
Sourcepub fn scheme(
self,
scheme: impl TryInto<Scheme, Error: Into<Error>>,
) -> Result<Self, Error>
pub fn scheme( self, scheme: impl TryInto<Scheme, Error: Into<Error>>, ) -> Result<Self, Error>
Sets the URI scheme for this request.
Defaults to Scheme::HTTPS.
Sets the authority (e.g. hostname) for this request.
Sourcepub fn path(self, path: impl Into<String>) -> Result<Self, Error>
pub fn path(self, path: impl Into<String>) -> Result<Self, Error>
Sets the path for this request.
May not contain query params (i.e. the character ‘?’).
See also Self::protobuf_rpc.
Sourcepub fn protobuf_rpc(
self,
full_service_name: impl AsRef<str>,
method_name: impl AsRef<str>,
) -> Result<Self, Error>
pub fn protobuf_rpc( self, full_service_name: impl AsRef<str>, method_name: impl AsRef<str>, ) -> Result<Self, Error>
Sets the path for this request from a protobuf RPC service/method.
See also Self::protobuf_rpc_with_routing_prefix.
Sourcepub fn protobuf_rpc_with_routing_prefix(
self,
routing_prefix: impl Into<String>,
full_service_name: impl AsRef<str>,
method_name: impl AsRef<str>,
) -> Result<Self, Error>
pub fn protobuf_rpc_with_routing_prefix( self, routing_prefix: impl Into<String>, full_service_name: impl AsRef<str>, method_name: impl AsRef<str>, ) -> Result<Self, Error>
Sets the path for this request from a routing prefix and protobuf RPC service/method.
Sourcepub fn uri(
self,
uri: impl TryInto<Uri, Error: Into<Error>>,
) -> Result<Self, Error>
pub fn uri( self, uri: impl TryInto<Uri, Error: Into<Error>>, ) -> Result<Self, Error>
Sets the scheme, authority, and path for this request from a URI.
Any query part of the URI is discarded.
Sourcepub fn ascii_metadata(
self,
key: impl TryInto<HeaderName, Error: Into<Error>>,
val: impl Into<String>,
) -> Result<Self, Error>
pub fn ascii_metadata( self, key: impl TryInto<HeaderName, Error: Into<Error>>, val: impl Into<String>, ) -> Result<Self, Error>
Appends ASCII metadata to the request.
Sourcepub fn binary_metadata(
self,
key: impl TryInto<HeaderName, Error: Into<Error>>,
val: impl AsRef<[u8]>,
) -> Result<Self, Error>
pub fn binary_metadata( self, key: impl TryInto<HeaderName, Error: Into<Error>>, val: impl AsRef<[u8]>, ) -> Result<Self, Error>
Appends binary metadata to the request.
Sourcepub fn message_codec(
self,
message_codec: impl Into<String>,
) -> Result<Self, Error>
pub fn message_codec( self, message_codec: impl Into<String>, ) -> Result<Self, Error>
Sets the message codec for this request.
Typical codecs are ‘json’ and ‘proto’, corresponding to the
content-types application/json and application/proto.
The caller is responsible for making sure the request payload matches this message codec.
Sourcepub fn timeout_ms(self, timeout_ms: u64) -> Result<Self, Error>
pub fn timeout_ms(self, timeout_ms: u64) -> Result<Self, Error>
Sets the request timeout in milliseconds.
Sourcepub fn clear_timeout(self) -> Self
pub fn clear_timeout(self) -> Self
Clears the request timeout.
Sourcepub fn content_encoding(
self,
content_encoding: impl Into<String>,
) -> Result<Self, Error>
pub fn content_encoding( self, content_encoding: impl Into<String>, ) -> Result<Self, Error>
Sets the request content encoding (e.g. compression).
Sourcepub fn accept_encoding<T: TryInto<HeaderValue, Error: Into<Error>>>(
self,
accept_encodings: impl IntoIterator<Item = T>,
) -> Result<Self, Error>
pub fn accept_encoding<T: TryInto<HeaderValue, Error: Into<Error>>>( self, accept_encodings: impl IntoIterator<Item = T>, ) -> Result<Self, Error>
Sets the request accept encoding(s).
Sourcepub fn unary<T>(self, body: T) -> Result<UnaryRequest<T>, Error>
pub fn unary<T>(self, body: T) -> Result<UnaryRequest<T>, Error>
Builds a UnaryRequest.
See: https://connectrpc.com/docs/protocol/#unary-request
Sourcepub fn streaming<T>(self, body: T) -> Result<StreamingRequest<T>, Error>
pub fn streaming<T>(self, body: T) -> Result<StreamingRequest<T>, Error>
Builds a StreamingRequest.
https://connectrpc.com/docs/protocol/#streaming-request
Sourcepub fn unary_get(
self,
message: impl AsRef<[u8]>,
) -> Result<UnaryGetRequest, Error>
pub fn unary_get( self, message: impl AsRef<[u8]>, ) -> Result<UnaryGetRequest, Error>
Builds a UnaryGetRequest.