Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions templates/sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,24 +317,26 @@ export class UniffiRustBufferValue {
paramsValue: [bytes],
});

const rustBuffer = uniffiCaller.rustCall(
(callStatus) => {
return FFI_DYNAMIC_LIB.{{ci.ffi_rustbuffer_from_bytes().name()}}([
// TODO: figure out why this is necessary.
{ data: unwrapPointer([dataPointer])[0], len: bytes.byteLength },
callStatus,
]);
},
/*liftString:*/ {{ &Type::String | typescript_ffi_converter_name }}.lift,
);

freePointer({
paramsType: [arrayConstructor({ type: DataType.U8Array, length: bytes.byteLength })],
paramsValue: [dataPointer],
pointerType: PointerType.RsPointer
});

return new UniffiRustBufferValue(rustBuffer);
try {
const rustBuffer = uniffiCaller.rustCall(
(callStatus) => {
return FFI_DYNAMIC_LIB.{{ci.ffi_rustbuffer_from_bytes().name()}}([
// TODO: figure out why this is necessary.
{ data: unwrapPointer([dataPointer])[0], len: bytes.byteLength },
callStatus,
]);
},
/*liftString:*/ {{ &Type::String | typescript_ffi_converter_name }}.lift,
);

return new UniffiRustBufferValue(rustBuffer);
} finally {
freePointer({
paramsType: [arrayConstructor({ type: DataType.U8Array, length: bytes.byteLength })],
paramsValue: [dataPointer],
pointerType: PointerType.RsPointer
});
}
}

static allocateEmpty() {
Expand Down
Loading