Browse Source

lang: strip Box when parsing idl types (#1947)

Krešimir Klas 3 years ago
parent
commit
37c5ff4c6d
1 changed files with 7 additions and 0 deletions
  1. 7 0
      lang/syn/src/idl/file.rs

+ 7 - 0
lang/syn/src/idl/file.rs

@@ -605,6 +605,13 @@ fn to_idl_type(ctx: &CrateContext, ty: &syn::Type) -> IdlType {
     if tts_string.starts_with('[') {
         tts_string = resolve_variable_array_lengths(ctx, tts_string);
     }
+    // Box<FooType> -> FooType
+    tts_string = tts_string
+        .strip_prefix("Box < ")
+        .and_then(|t| t.strip_suffix(" >"))
+        .unwrap_or(&tts_string)
+        .into();
+
     tts_string.parse().unwrap()
 }