sl4f_lib/modular/
types.rs1use serde::{Deserialize, Serialize};
5
6pub enum ModularMethod {
8 RestartSession,
9 StartBasemgr,
10 KillBasemgr,
11 IsBasemgrRunning,
12}
13
14impl std::str::FromStr for ModularMethod {
15 type Err = anyhow::Error;
16
17 fn from_str(method: &str) -> Result<Self, Self::Err> {
18 match method {
19 "RestartSession" => Ok(ModularMethod::RestartSession),
20 "StartBasemgr" => Ok(ModularMethod::StartBasemgr),
21 "KillBasemgr" => Ok(ModularMethod::KillBasemgr),
22 "IsBasemgrRunning" => Ok(ModularMethod::IsBasemgrRunning),
23 _ => return Err(format_err!("invalid ModularMethod: {}", method)),
24 }
25 }
26}
27
28#[derive(Serialize, Deserialize, Debug)]
29pub enum RestartSessionResult {
30 Success,
31 NoSessionToRestart,
32 Fail,
33}
34
35#[derive(Serialize, Deserialize, Debug)]
36pub enum BasemgrResult {
37 Success,
38 Fail,
39}
40
41#[derive(Serialize, Deserialize, Debug)]
42pub enum KillSessionResult {
43 Success,
44 NoSessionRunning,
45}
46
47#[derive(Deserialize, Default, Debug)]
48pub struct StartBasemgrRequest {
49 pub session_url: String,
52}
53
54#[derive(Deserialize, Default, Debug)]
55pub struct SessionArgs {
56 pub url: String,
59}