[go: up one dir, main page]

pub struct RouteContext<D> {
    pub data: D,
    pub env: Env,
    /* private fields */
}
Expand description

Container for a route’s parsed parameters, data, and environment bindings from the Runtime (such as KV Stores, Durable Objects, Variables, and Secrets).

Fields

data: Denv: Env

Implementations

👎Deprecated since 0.0.8:

please use the data field directly

Get a reference to the generic associated data provided to the Router.

👎Deprecated since 0.0.8:

please use the env field directly

Get the Env for this Worker. Typically users should opt for the secret, var, kv and durable_object methods on the RouteContext instead.

Get a Secret value associated with this Worker, should one exist.

Get an Environment Variable value associated with this Worker, should one exist.

Get a KV Namespace associated with this Worker, should one exist.

Get a Durable Object Namespace associated with this Worker, should one exist.

Get a URL parameter parsed by the router, by the name of its match or wildecard placeholder.

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.