use async_trait::async_trait;
use super::constants::DEFAULT_PROFILE;
use super::launch;
use super::launch::LaunchResult;
use super::launch_params::LaunchBevyBinaryParams;
use crate::error::Error;
use crate::error::Result;
use crate::tool;
use crate::tool::HandlerContext;
use crate::tool::HandlerResult;
use crate::tool::ToolFn;
use crate::tool::ToolResult;
pub struct LaunchBevyTarget;
#[async_trait]
impl ToolFn for LaunchBevyTarget {
type Output = LaunchResult;
type Params = LaunchBevyBinaryParams;
fn call(
&self,
context: HandlerContext,
) -> HandlerResult<'_, ToolResult<Self::Output, Self::Params>> {
tool::call_with_typed_params(context, |_, params: LaunchBevyBinaryParams| async move {
launch::launch_bevy_target(params, DEFAULT_PROFILE)
})
}
async fn handle_impl(&self, _: Self::Params) -> Result<Self::Output> {
Err(
Error::InvalidState("LaunchBevyTarget uses its custom call implementation".to_string())
.into(),
)
}
}
pub const fn create_launch_handler() -> LaunchBevyTarget { LaunchBevyTarget }