pub trait ForwardPolicy:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> ForwardPolicyName;
fn forward(
&self,
caller_ctx: &AuthContext,
site: &CallSite,
) -> ForwardDerivation;
}Expand description
The forwarding-policy trait.
v1 is intentionally minimal: one name, one infallible forward. A
custom impl receives the caller’s sealed AuthContext and the
CallSite for the edge being dispatched, and returns a
ForwardDerivation describing which fields the framework should
retain when constructing the callee’s context.
§Why infallible
The three built-in policies are pure tag manipulation. A fallible
variant would force every wire-in site to handle an error case that
none of the v1 built-ins can produce. Future fallible policies are a
sibling trait (FallibleForwardPolicy), added without breaking v1’s
shape. See AUTHLANG-S01-output §1.
§Object safety
Send + Sync + 'static matches the existing Arc<dyn ChildRouter> and
Arc<dyn AuditSink> patterns in plexus-core, so wire-in code can hold
a Arc<dyn ForwardPolicy>.
Required Methods§
Sourcefn name(&self) -> ForwardPolicyName
fn name(&self) -> ForwardPolicyName
Stable identifier for this policy. Used in audit records.
Sourcefn forward(
&self,
caller_ctx: &AuthContext,
site: &CallSite,
) -> ForwardDerivation
fn forward( &self, caller_ctx: &AuthContext, site: &CallSite, ) -> ForwardDerivation
Derive forwarding parameters for the callee.
Returns a ForwardDerivation — parameters, not a constructed
context. The framework calls
AuthContext::derive_callee_context
with these parameters to mint the sealed callee context.