pub trait ProtocolPlugin: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn alpn(&self) -> Option<Vec<u8>>;
fn on_runtime_ready<'life0, 'async_trait>(
&'life0 self,
context: RuntimeContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn kind(&self) -> ProtocolPluginKind { ... }
fn router_handler(&self) -> Option<Box<dyn DynProtocolHandler>> { ... }
fn has_router_handler(&self) -> bool { ... }
fn readiness(&self) -> ProtocolPluginReadiness { ... }
fn descriptor(&self) -> ProtocolPluginDescriptor { ... }
}Required Methods§
fn name(&self) -> &'static str
fn alpn(&self) -> Option<Vec<u8>>
fn on_runtime_ready<'life0, 'async_trait>(
&'life0 self,
context: RuntimeContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Provided Methods§
Sourcefn kind(&self) -> ProtocolPluginKind
fn kind(&self) -> ProtocolPluginKind
Delegation rule:
- Rust owns protocol registration and runtime lifecycle
- plugins describe how they integrate with the runtime, but they do not become a second lifecycle engine
Sourcefn router_handler(&self) -> Option<Box<dyn DynProtocolHandler>>
fn router_handler(&self) -> Option<Box<dyn DynProtocolHandler>>
Optional native router handler.
Plugins that return a handler here can be wired directly into an iroh
RouterBuilder through ProtocolRegistry::apply_router_handlers().
Session-adjacent plugins should leave this as None.
fn has_router_handler(&self) -> bool
fn readiness(&self) -> ProtocolPluginReadiness
fn descriptor(&self) -> ProtocolPluginDescriptor
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".