Skip to main content

proxima_primitives/pipe/
plugin.rs

1//! Plugin registration trait surface. Used by external plugin crates to
2//! register pipe factories without depending on the umbrella `proxima`
3//! crate. `AppBuilder` in the umbrella implements this trait so the
4//! existing `plugin::register(app_builder)` call sites keep working.
5
6#![cfg(feature = "alloc")]
7
8use proxima_core::ProximaError;
9
10use crate::pipe::pipe_factory::DynPipeFactory;
11
12/// Surface a plugin can register against. Equivalent to the relevant
13/// subset of methods on `AppBuilder` in the umbrella `proxima` crate.
14/// Adding methods here is breaking; keep the surface minimal.
15pub trait PluginRegistry: Sized {
16    /// Register a pipe factory under the name embedded in the factory.
17    /// Returns the builder with the factory registered. Errors if a
18    /// factory with the same name is already registered.
19    ///
20    /// # Errors
21    /// Returns `ProximaError` if registration fails (duplicate name,
22    /// invalid factory shape, etc.).
23    fn with_upstream_factory(self, factory: DynPipeFactory) -> Result<Self, ProximaError>;
24}