Skip to main content

r2_binding_name

Function r2_binding_name 

Source
pub fn r2_binding_name(bucket: &str) -> String
Expand description

The Worker binding name a bucket route reads its bucket through: noisetable-releases → R2_NOISETABLE_RELEASES.

Deterministic, so the table entry and the binding list agree without either carrying a lookup, and collision-free: an R2 bucket name is lowercase letters, digits and hyphens only (refused otherwise at parse time), so upper-casing and - → _ is injective. The R2_ prefix keeps every such binding clear of the plain-text ones (ASSET_ORIGIN, ROUTE_TABLE, …).