pub trait ErasedStrategy:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &Name;
fn decide_sync(
&self,
ctx: &StrategyContext<'_>,
) -> Option<SmallVec<[ForwardingAction; 2]>>;
fn after_receive_interest_erased<'a>(
&'a self,
ctx: &'a StrategyContext<'a>,
) -> Pin<Box<dyn Future<Output = SmallVec<[ForwardingAction; 2]>> + Send + 'a>>;
fn on_nack_erased<'a>(
&'a self,
ctx: &'a StrategyContext<'a>,
reason: NackReason,
) -> Pin<Box<dyn Future<Output = ForwardingAction> + Send + 'a>>;
}Expand description
Object-safe version of Strategy that boxes its futures.
Required Methods§
Sourcefn name(&self) -> &Name
fn name(&self) -> &Name
Canonical name identifying this strategy (e.g. /localhost/nfd/strategy/best-route).
Sourcefn decide_sync(
&self,
ctx: &StrategyContext<'_>,
) -> Option<SmallVec<[ForwardingAction; 2]>>
fn decide_sync( &self, ctx: &StrategyContext<'_>, ) -> Option<SmallVec<[ForwardingAction; 2]>>
Synchronous fast path — avoids the Box::pin heap allocation.
Returns None to fall through to the async path.
Sourcefn after_receive_interest_erased<'a>(
&'a self,
ctx: &'a StrategyContext<'a>,
) -> Pin<Box<dyn Future<Output = SmallVec<[ForwardingAction; 2]>> + Send + 'a>>
fn after_receive_interest_erased<'a>( &'a self, ctx: &'a StrategyContext<'a>, ) -> Pin<Box<dyn Future<Output = SmallVec<[ForwardingAction; 2]>> + Send + 'a>>
Async path for Interest forwarding decisions (boxed future).
Sourcefn on_nack_erased<'a>(
&'a self,
ctx: &'a StrategyContext<'a>,
reason: NackReason,
) -> Pin<Box<dyn Future<Output = ForwardingAction> + Send + 'a>>
fn on_nack_erased<'a>( &'a self, ctx: &'a StrategyContext<'a>, reason: NackReason, ) -> Pin<Box<dyn Future<Output = ForwardingAction> + Send + 'a>>
Handle an incoming Nack and decide whether to retry or propagate.