pub struct Request<'a, Req, Res = ()> { /* private fields */ }Expand description
This struct encapsulates the parameters for a request to a service.
Implementations§
Source§impl<'a, Req, Res> Request<'a, Req, Res>
impl<'a, Req, Res> Request<'a, Req, Res>
pub fn header(self, key: String, value: String) -> Self
Sourcepub fn idempotency_key(self, idempotency_key: impl Into<String>) -> Self
pub fn idempotency_key(self, idempotency_key: impl Into<String>) -> Self
Add idempotency key to the request
Sourcepub fn scope(self, scope: impl Into<String>) -> Self
pub fn scope(self, scope: impl Into<String>) -> Self
Route this request within the given scope.
A scope is a sub-grouping of resources (invocations, virtual object instances, workflow executions). Under the hood the scope contributes to the partition key, so all resources in a scope get co-located by the restate-server. Idempotency keys are scoped, so the same idempotency key in two different scopes refers to two distinct requests.
Sourcepub fn limit_key(self, limit_key: impl Into<String>) -> Self
pub fn limit_key(self, limit_key: impl Into<String>) -> Self
Add a concurrency limit key to the request.
The limit key enforces hierarchical concurrency limits on invocations sharing the same
scope. It can only be used in conjunction with a scope (see Request::scope).
Sourcepub fn call(self) -> impl CallFuture<Response = Res> + Sendwhere
Req: Serialize + 'static,
Res: Deserialize + 'static,
pub fn call(self) -> impl CallFuture<Response = Res> + Sendwhere
Req: Serialize + 'static,
Res: Deserialize + 'static,
Call a service. This returns a future encapsulating the response.
Sourcepub fn send(self) -> SendHandlewhere
Req: Serialize + 'static,
pub fn send(self) -> SendHandlewhere
Req: Serialize + 'static,
Send the request to the service, without waiting for the response.
The request is sent eagerly; you can drop the returned SendHandle to fire-and-forget,
or .await it to obtain an InvocationHandle to the newly created invocation.
Sourcepub fn send_after(self, delay: Duration) -> SendHandlewhere
Req: Serialize + 'static,
pub fn send_after(self, delay: Duration) -> SendHandlewhere
Req: Serialize + 'static,
Schedule the request to the service, without waiting for the response.
Same as Request::send, but the invocation is executed after the given delay.
Auto Trait Implementations§
impl<'a, Req, Res> Freeze for Request<'a, Req, Res>where
Req: Freeze,
impl<'a, Req, Res> RefUnwindSafe for Request<'a, Req, Res>where
Req: RefUnwindSafe,
Res: RefUnwindSafe,
impl<'a, Req, Res> Send for Request<'a, Req, Res>
impl<'a, Req, Res> Sync for Request<'a, Req, Res>
impl<'a, Req, Res> Unpin for Request<'a, Req, Res>
impl<'a, Req, Res> UnsafeUnpin for Request<'a, Req, Res>where
Req: UnsafeUnpin,
impl<'a, Req, Res> UnwindSafe for Request<'a, Req, Res>where
Req: UnwindSafe,
Res: UnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more