Skip to main content

CompiledRoute

Struct CompiledRoute 

Source
pub struct CompiledRoute {
    pub route_key: String,
    pub args: Vec<FieldRule>,
    pub policy: Vec<Effect>,
    pub result: Vec<FieldRule>,
    pub post_policy: Vec<Effect>,
    pub plugin_overrides: HashMap<String, PluginOverride>,
    pub response: Option<DenyResponse>,
}
Expand description

Compiler output for a single route.

One CompiledRoute per route_key. The compiler merges global / default / tag / route-specific rules from the config hierarchy down into these four phase lists before the evaluator sees them — the IR has no notion of “tag rules” or “route overrides,” only “steps that fire in phase P.”

args and result are per-field pipelines (validators + transforms). policy and post_policy are step lists — predicate-and-action rules plus PDP calls, plugin invocations, and taint effects. See apl-dsl-spec §1.2 / §4 / §7.

Fields§

§route_key: String§args: Vec<FieldRule>§policy: Vec<Effect>§result: Vec<FieldRule>§post_policy: Vec<Effect>§plugin_overrides: HashMap<String, PluginOverride>

Per-plugin overrides declared on this route’s plugins: block. Keyed by plugin name; merged at dispatch time via EffectivePlugin::resolve(name, registry, &this.plugin_overrides). Per spec only config, capabilities, on_error are overridable; hooks/kind/source always come from the global declaration.

§response: Option<DenyResponse>

Custom denial response (transpiled denyWith). Most-specific layer wins on collision. None leaves the host’s default denial behavior.

Implementations§

Source§

impl CompiledRoute

Source

pub fn new(route_key: impl Into<String>) -> Self

Source

pub fn declared_phases(&self) -> PhaseSet

Which phases this route uses. Empty phases are not declared.

Source

pub fn apply_layer(&mut self, more_specific: CompiledRoute)

Apply a more-specific policy layer on top of this one. Used by orchestrators (apl-cpex’s visitor) to stack the unified-config hierarchy least-to-most-specific:

effective = CompiledRoute::default()
effective.apply_layer(global_block)
effective.apply_layer(default_block)
effective.apply_layer(tag_block)
effective.apply_layer(route_block)

Each call adds the parameter on top of what’s already there; more_specific wins on collisions because it represents a later/narrower layer in the inheritance chain.

Merge semantics:

  • policy / post_policy: more_specific’s steps append after self’s. Earlier layers run first — globals deny before route-specific rules get a chance.
  • args / result: per-field; if both layers declare the same field, more_specific’s rule replaces self’s. Fields only in self stay; fields only in more_specific are added.
  • plugin_overrides: HashMap merge; more_specific wins on key collisions, otherwise prefix’s entries fill gaps.

self.route_key is preserved — apply_layer doesn’t overwrite identity, just policy content.

Trait Implementations§

Source§

impl Clone for CompiledRoute

Source§

fn clone(&self) -> CompiledRoute

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 Debug for CompiledRoute

Source§

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

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

impl Default for CompiledRoute

Source§

fn default() -> CompiledRoute

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for CompiledRoute

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CompiledRoute

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.