Struct do_proxy::Proxy

source ·
pub struct Proxy<O> { /* private fields */ }
Expand description

A wrapper around a worker::Stub that provides a builder interface for sending requests. This is the only way to send requests to a durable object in a type-safe way.

Create proxies using the crate::EnvExt trait.

The Builder type returned by Proxy::send and Proxy::init implements std::future::IntoFuture. This means, you must use .await to actually send the request.

Implementations

Send a request to the durable object. You must await this future to

Example
let resp = proxy.send(Command::GetBirthday).await?;

Send a request to the durable object. You can immediately await the result of this method to initialize the object, or you can chain a .and_send() call to have the object handle a request after it is initialized.

Example
// Initialize a person object, no response is expected.
proxy.init(Person::new("Bob")).await?;

// or
let resp = proxy.init(Person::new("Bob")).and_send(Command::GetBirthday).await?;

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.