Expand description
Исполнитель - структура для запуска компонентов
§Пример с WASM и cmp_leptos
use std::time::Duration;
use leptos::{
    prelude::*,
    task::{spawn_local, Executor},
};
use reactive_stores::Store;
use tokio::task::LocalSet;
use crate::{
    components::cmp_leptos,
    executor::{ComponentExecutor, ComponentExecutorConfig},
    logging::configure_logging,
    message::example_message::*,
};
#[test]
#[allow(dead_code)]
fn test_wasm() {
    fn main() -> anyhow::Result<()> {
        #[component]
        fn App() -> impl IntoView {}
        configure_logging("info").unwrap();
        #[derive(Default, Clone, Store)]
        struct GlobalStore {}
        impl cmp_leptos::StoreBound for GlobalStore {}
        // cmp_leptos ------------------------------------------------------------------------------
        let config_leptos = cmp_leptos::Config {
            body_component: || view! { <App/>}.into_any(),
            input_store: GlobalStore::default(),
            output_store: GlobalStore::default(),
            fn_input: |_, _| (),
            fn_output: |_, _| (),
        };
        // config_executor -------------------------------------------------------------------------
        let config_executor = ComponentExecutorConfig {
            buffer_size: 100,
            fn_auth: |msg, _| Some(msg),
            delay_publish: Duration::from_millis(100),
        };
        // executor --------------------------------------------------------------------------------
        Executor::init_wasm_bindgen().expect("executor should only be initialized once");
        let context = LocalSet::new();
        context.spawn_local(async move {
            ComponentExecutor::<Custom>::new(config_executor)
                .add_cmp(cmp_leptos::Cmp::new(config_leptos))
                .wait_result()
                .await?;
            Ok(()) as anyhow::Result<()>
        });
        spawn_local(context);
        Ok(())
    }
}Structs§
- Cache
 - Кеш сообщений
 - CmpIn
Out  - Подключение компонента к внутренней шине сообщений исполнителя
 - Component
 - Представление обобщенного компонента
 - Component
Executor  - Запуск коллекции компонентов в работу
 - Component
Executor Config  - Настройка исполнителя
 
Enums§
- Component
Error  - Ошибки исполненителя компонентов
 
Traits§
- Check
Capacity  - Проверка емкости канала
 - IComponent
Process  - Трейт основной функции компонента
 
Functions§
- join_
set_ spawn  - Добавить задачу в множество задач (многопоточная версия)
 - sleep
 - Waits until 
durationhas elapsed. 
Type Aliases§
- CmpResult
 - Тип возвращаемого значения функции 
processкомпонента