pub struct PluginRegistry {
pub registry: Registry,
pub handlers: HandlerRegistry,
pub current_prefix: Option<String>,
pub capabilities: CapabilityRegistry,
pub const_coercers: Arc<RwLock<HashMap<&'static str, Box<dyn Fn(&Value) -> Option<Box<dyn Any + Sync + Send>> + Sync + Send>>>>,
pub output_movers: Arc<RwLock<HashMap<TypeId, Box<dyn Fn(Box<dyn Any + Sync + Send>) -> EdgePayload + Sync + Send>>>>,
pub type_compatibilities: BTreeSet<(TypeExpr, TypeExpr)>,
}Expand description
Container for descriptors + handlers. All nodes are installed via plugins.
Fields§
§registry: Registry§handlers: HandlerRegistry§current_prefix: Option<String>§capabilities: CapabilityRegistry§const_coercers: Arc<RwLock<HashMap<&'static str, Box<dyn Fn(&Value) -> Option<Box<dyn Any + Sync + Send>> + Sync + Send>>>>§output_movers: Arc<RwLock<HashMap<TypeId, Box<dyn Fn(Box<dyn Any + Sync + Send>) -> EdgePayload + Sync + Send>>>>§type_compatibilities: BTreeSet<(TypeExpr, TypeExpr)>Implementations§
Source§impl PluginRegistry
impl PluginRegistry
pub fn new() -> PluginRegistry
pub fn merge<N>(&mut self) -> Result<(), &'static str>where
N: NodeInstall,
pub fn take_handlers(&mut self) -> HandlerRegistry
Sourcepub fn register_conversion<S, T>(&mut self, f: fn(&S) -> Option<T>)
pub fn register_conversion<S, T>(&mut self, f: fn(&S) -> Option<T>)
Register an application-specific CPU-side conversion (available to all nodes).
Sourcepub fn register_const_coercer<T, F>(&mut self, coercer: F)
pub fn register_const_coercer<T, F>(&mut self, coercer: F)
Register a conversion for constant default values.
This is the preferred API for dynamic plugins so the host and plugin share a single
coercer map stored in the host-owned PluginRegistry.
Sourcepub fn register_value_serializer<T, F>(&mut self, serializer: F)
pub fn register_value_serializer<T, F>(&mut self, serializer: F)
Register a serializer for outbound host-bridge values.
This enables host-bridge serialization for plugin-defined structured payload types by
converting them into daedalus_data::model::Value.
Sourcepub fn register_output_mover<T, F>(&mut self, mover: F)
pub fn register_output_mover<T, F>(&mut self, mover: F)
Register an output mover to emit a typed output payload by value.
Sourcepub fn register_type_compatibility(&mut self, from: TypeExpr, to: TypeExpr)
pub fn register_type_compatibility(&mut self, from: TypeExpr, to: TypeExpr)
Register a type-compatibility edge to support dynamic port polling.
Dynamic plugins should use this API so compat data is stored in the host registry.
Sourcepub fn apply_type_compatibilities(&self)
pub fn apply_type_compatibilities(&self)
Apply any registered compatibility edges to the host typing registry.
Sourcepub fn register_enum<T>(
&mut self,
variants: impl IntoIterator<Item = impl Into<String>>,
)
pub fn register_enum<T>( &mut self, variants: impl IntoIterator<Item = impl Into<String>>, )
Register an enum type for UI/typing and enable constant binding for it.
This lets node function signatures take a strongly-typed enum (e.g. mode: ExecMode)
while allowing JSON-authored graphs to provide the value as either:
Value::Int(2)(index into the registered variant list)Value::String("cpu")(variant name)Value::Enum { name: "cpu", .. }(variant name)
The enum T must be DeserializeOwned so we can construct it from the variant name.
Sourcepub fn register_capability_typed<T, F>(&mut self, key: impl Into<String>, f: F)
pub fn register_capability_typed<T, F>(&mut self, key: impl Into<String>, f: F)
Register a typed capability entry keyed by a string. The provided function operates on typed references; downcasting is handled internally.
Trait Implementations§
Source§impl Default for PluginRegistry
impl Default for PluginRegistry
Source§fn default() -> PluginRegistry
fn default() -> PluginRegistry
Source§impl RegistryPluginExt for PluginRegistry
impl RegistryPluginExt for PluginRegistry
Auto Trait Implementations§
impl Freeze for PluginRegistry
impl !RefUnwindSafe for PluginRegistry
impl Send for PluginRegistry
impl Sync for PluginRegistry
impl Unpin for PluginRegistry
impl !UnwindSafe for PluginRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().