From 0c1c73cd71a3abbd248cd7fef34113b5154842d3 Mon Sep 17 00:00:00 2001 From: Daniel Vigovszky Date: Fri, 23 Feb 2024 10:03:54 +0100 Subject: [PATCH] Support the new handle type --- src/clients/template.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/clients/template.rs b/src/clients/template.rs index 109ed81..a527802 100644 --- a/src/clients/template.rs +++ b/src/clients/template.rs @@ -17,7 +17,8 @@ use std::io::Read; use async_trait::async_trait; use golem_client::model::{ Export, ExportFunction, ExportInstance, FunctionParameter, FunctionResult, NameOptionTypePair, - NameTypePair, Template, Type, TypeEnum, TypeFlags, TypeRecord, TypeTuple, TypeVariant, + NameTypePair, ResourceMode, Template, Type, TypeEnum, TypeFlags, TypeRecord, TypeTuple, + TypeVariant, }; use serde::{Deserialize, Serialize}; use tokio::fs::File; @@ -151,6 +152,10 @@ fn render_type(typ: &Type) -> String { Type::U8 { .. } => "u8".to_string(), Type::S8 { .. } => "s8".to_string(), Type::Bool { .. } => "bool".to_string(), + Type::Handle(handle) => match handle.mode { + ResourceMode::Borrowed => format!("&handle<{}>", handle.resource_id), + ResourceMode::Owned => format!("handle<{}>", handle.resource_id), + }, } }