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

This commit is contained in:
Krešimir Klas 2022-06-05 02:34:47 +02:00 committed by GitHub
parent 7fe39c61ad
commit 37c5ff4c6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -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()
}