Mountain/RPC/CocoonService/Provider/
ProvideTypeHierarchySupertypes.rs1
2use serde_json::json;
5use tonic::{Response, Status};
6use CommonLibrary::LanguageFeature::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
7
8use crate::{
9 RPC::CocoonService::CocoonServiceImpl,
10 Vine::Generated::{ProvideTypeHierarchyRequest, ProvideTypeHierarchyResponse},
11 dev_log,
12};
13
14pub async fn Fn(
15 Service:&CocoonServiceImpl,
16
17 Request:ProvideTypeHierarchyRequest,
18) -> Result<Response<ProvideTypeHierarchyResponse>, Status> {
19 dev_log!("cocoon", "[CocoonService] Providing type hierarchy supertypes");
20
21 let ItemDTO = json!({
22 "name": Request.item.as_ref().map(|I| I.name.as_str()).unwrap_or(""),
23 "uri": Request.uri.as_ref().map(|U| U.value.as_str()).unwrap_or(""),
24 });
25
26 match Service.environment.ProvideTypeHierarchySupertypes(ItemDTO).await {
27 Ok(_) => Ok(Response::new(<ProvideTypeHierarchyResponse>::default())),
28
29 Err(Error) => Err(Status::internal(format!("type hierarchy supertypes failed: {}", Error))),
30 }
31}