Skip to main content

RoutePolicy

Enum RoutePolicy 

Source
pub enum RoutePolicy {
    Requires,
    CachePolicy,
    Concurrency,
    Resilience,
}
Expand description

A route field that changes serving behaviour, and can therefore fail open when the serving tier does not implement it.

Deliberately not “every field on crate::manifest::Route” — build-time and publish-time fields (prerender, data_inputs, placement, source_reads, hydration) are consumed before a request exists, so a server that ignores them cannot serve a route that quietly lacks a policy it declared. See STRUCTURAL_FIELDS for that half of the partition; every key on Route belongs to exactly one of the two, pinned by every_route_field_is_classified.

Variants§

§

Requires

requires: ["user" | "project" | "region"] — the auth gate. The one whose fail-open is a confidentiality breach rather than a performance regression, which is why R556-B13 was filed at severity high.

§

CachePolicy

cache_policy: { ttl, swr, negative_ttl, vary }.

§

Concurrency

concurrency — per-route in-flight cap.

§

Resilience

resilience: { retry, timeout_ms } (W181).

Implementations§

Source§

impl RoutePolicy

Source

pub const ALL: [RoutePolicy; 4]

Every policy, in declaration order. Nothing at compile time checks this list is complete — parse() searches it at runtime — so a variant left out here is caught only by every_route_field_is_classified below.

Source

pub const fn field(self) -> &'static str

The manifest / defineRoutes field name. This is what an author reads in their own routes file, so it is what a refusal message must name.

Source

pub const fn effect(self) -> &'static str

What an author expects the field to do, one clause. Rendered into the refusal so the message says what is being lost, not just which key.

Source

pub fn parse(field: &str) -> Option<Self>

Parse a field name, for --policy-delegated / MESOFACT_POLICY_DELEGATED.

Source

pub const fn subfields(self) -> &'static [&'static str]

For a policy carried as a JSON object, the sub-keys this build actually implements. Empty = the policy is a scalar/array with no inner shape.

Checked as strictly as the top level, because a policy’s sub-field is the same defect one level down and hides better: serde on crate::manifest::CachePolicy silently drops an unknown key, so a cache_policy.private added by a newer build would deserialize into a policy that looks complete and quietly is not.

resilience.queue is deliberately absent — W181 reserves the slot for v2 and defineRoutes rejects it today, so the type exists only so v1 binaries keep deserializing v2 manifests. Deserializing one is not the same as honouring it; a manifest that carries a queue policy must not be served as though the queueing happens.

Source

pub const fn reserved_subfields(self) -> &'static [&'static str]

Sub-keys that exist on the manifest type and are deliberately not implemented. Listing them is what turns “we left it out” into a decision the completeness gate can check, and it keeps subfields’s omissions from reading as oversights.

Trait Implementations§

Source§

impl Clone for RoutePolicy

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RoutePolicy

Source§

impl Debug for RoutePolicy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for RoutePolicy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RoutePolicy

Source§

impl Ord for RoutePolicy

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for RoutePolicy

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for RoutePolicy

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for RoutePolicy

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more