Skip to main content

DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/RPC/CocoonService/Command/
UnregisterCommand.rs

1//! Remove a previously-registered Cocoon command from the executor.
2
3use CommonLibrary::Command::CommandExecutor::CommandExecutor;
4use tonic::{Response, Status};
5
6use crate::{
7	RPC::CocoonService::CocoonServiceImpl,
8	Vine::Generated::{Empty, UnregisterCommandRequest},
9	dev_log,
10};
11
12pub async fn Fn(Service:&CocoonServiceImpl, Request:UnregisterCommandRequest) -> Result<Response<Empty>, Status> {
13	dev_log!("cocoon", "[CocoonService] Unregistering command '{}'", Request.command_id);
14
15	if let Err(Error) = Service
16		.environment
17		.UnregisterCommand(String::new(), Request.command_id.clone())
18		.await
19	{
20		dev_log!(
21			"cocoon",
22			"warn: [CocoonService] Failed to unregister command '{}': {:?}",
23			Request.command_id,
24			Error
25		);
26	} else {
27		dev_log!("cocoon", "[CocoonService] Command removed: {}", Request.command_id);
28	}
29
30	Ok(Response::new(Empty {}))
31}