Crate do_proxy

source ·
Expand description

do-proxy

A library for writing type-safe Durable Objects (DOs) in Rust.

With do-proxy you can:

  • Easily write type-safe APIs for Durable Objects.
  • Abstract over fetch, alarm and request-response glue code.

Overview

do-proxy provides a core trait DoProxy that abstracts over ser/de request response code, object initalization and loading, and Error handling glue code.

After a struct implements DoProxy, the macro do_proxy! creates the workers-rs#[DurableObject] struct which ends up generating the final object.

See DoProxy for more details.

Re-exports

pub use ::paste;
pub use ::worker;

Macros

Generates worker-rs worker::DurableObject glue code for a type that impls crate::DoProxy.

Structs

The context that is passed to the object’s init, load_from_storage, and handle functions.
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.

Enums

An enum of either a crate::Error or a user provided error, usually a crate::DoProxy::Error.
A simple error type for do-proxy.
A request sent to an object.

Traits

The DoProxy trait is the main interface of this library. Implement this trait for a type you want to make into a durable object and automatically get many helper methods for interacting with it.
The EnvExt trait makes it easy to create proxies from a worker::Env.

Attribute Macros