Mountain/Track/Effect/CreateEffectForRequest/
Keybinding.rs1#![allow(non_snake_case, unused_variables, dead_code, unused_imports)]
2
3use std::{future::Future, pin::Pin, sync::Arc};
4
5use CommonLibrary::{Environment::Requires::Requires, Keybinding::KeybindingProvider::KeybindingProvider};
6use serde_json::{Value, json};
7use tauri::Runtime;
8
9use crate::{RunTime::ApplicationRunTime::ApplicationRunTime, Track::Effect::MappedEffectType::MappedEffect};
10
11pub fn CreateEffect<R:Runtime>(MethodName:&str, Parameters:Value) -> Option<Result<MappedEffect, String>> {
12 match MethodName {
13 "Keybinding.GetResolved" => {
14 let effect =
15 move |run_time:Arc<ApplicationRunTime>| -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send>> {
16 Box::pin(async move {
17 let provider:Arc<dyn KeybindingProvider> = run_time.Environment.Require();
18 provider.GetResolvedKeybinding().await.map_err(|e| e.to_string())
19 })
20 };
21 Some(Ok(Box::new(effect)))
22 },
23
24 _ => None,
25 }
26}