sl4f_lib/component/
types.rsuse serde::{Deserialize, Serialize};
pub enum ComponentMethod {
Launch,
List,
Search,
}
impl std::str::FromStr for ComponentMethod {
type Err = anyhow::Error;
fn from_str(method: &str) -> Result<Self, Self::Err> {
match method {
"Launch" => Ok(ComponentMethod::Launch),
"List" => Ok(ComponentMethod::List),
"Search" => Ok(ComponentMethod::Search),
_ => return Err(format_err!("Invalid Component Facade method: {}", method)),
}
}
}
#[derive(Deserialize, Debug)]
pub struct ComponentSearchRequest {
pub name: Option<String>,
}
#[derive(Serialize, Deserialize, Debug)]
pub enum ComponentSearchResult {
Success,
NotFound,
}
#[derive(Deserialize, Debug)]
pub struct ComponentLaunchRequest {
pub url: Option<String>,
pub arguments: Option<Vec<String>>,
pub wait_until_stop: bool,
}
#[derive(Serialize, Deserialize, Debug)]
pub enum ComponentLaunchResponse {
Success,
Fail(i64),
}