pub struct Operation<T> { /* private fields */ }Expand description
A mutation the API accepted and carries out after answering. Its
result, a T, is the resource it acted on, or
Empty for a delete.
Implementations§
Source§impl<T: DeserializeOwned> Operation<T>
impl<T: DeserializeOwned> Operation<T>
Sourcepub fn new(
service: Service,
operation: Operation,
result_type: &'static str,
) -> Self
pub fn new( service: Service, operation: Operation, result_type: &'static str, ) -> Self
The operation operation, which a method of service answered
with; its result is the message result_type, such as
origincloud.pvs.v1beta1.Volume. The generated clients call it.
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The operation’s resource name, by which Operation::wait and a
service’s OperationClient find it.
Sourcepub async fn wait(&mut self) -> Result<T, Error>
pub async fn wait(&mut self) -> Result<T, Error>
Waits until the operation finishes and returns its result, or the
Error::Api it failed with. Once it returns a result, reads
through the same Client show the operation’s
effect.
Each call asks the API to wait up to
ClientBuilder::operation_wait,
a minute by default, and less than the client’s
timeout. A call that times out
all the same, such as under a shorter timeout of the HTTP client’s
own, counts as the operation not being done yet: the next call is
sent, without using up the call’s retries.
It waits as long as the operation takes; to bound that, wrap it in a
timeout such as tokio::time::timeout, which stops waiting, not the
operation.
Sourcepub fn result(&self) -> Result<T, Error>
pub fn result(&self) -> Result<T, Error>
The result of an operation that is done, or the Error::Api it
failed with. It fails with Error::NotDone for an operation that
isn’t done yet.