iridis_url_scheme/
plugin.rs

1//! This module contains the `UrlSchemePlugin` trait and its implementations.
2
3use std::sync::Arc;
4
5use crate::prelude::{thirdparty::tokio::task::JoinHandle, *};
6
7/// This trait must be implemented in order to make a plugin compatible with the `iridis_url_scheme` crate.
8pub trait UrlSchemePlugin: Send + Sync {
9    /// Thisfunction is called when the plugin is loaded.
10    #[allow(clippy::new_ret_no_self)]
11    fn new() -> JoinHandle<Result<Box<dyn UrlSchemePlugin>>>
12    where
13        Self: Sized;
14
15    /// This function is called when the plugin is loaded to determine which URL schemes it supports.
16    fn target(&self) -> Vec<String>;
17
18    /// This function is called to load a `Node` from the plugin.
19    #[allow(clippy::too_many_arguments)]
20    fn load(
21        &self,
22        url: Url,
23
24        inputs: Inputs,
25        outputs: Outputs,
26        queries: Queries,
27        queryables: Queryables,
28        configuration: serde_yml::Value,
29
30        file_ext: Arc<FileExtManager>,
31    ) -> JoinHandle<Result<RuntimeNode>>;
32}
33
34/// This type is used to represent the return type of the `C` symbolic function that instantiates the plugin.
35pub type DynamicallyLinkedUrlSchemePluginInstance =
36    fn() -> JoinHandle<Result<Box<dyn UrlSchemePlugin>>>;