From 3df61ab74f52c2c51f48243071d23a1443e05d6f Mon Sep 17 00:00:00 2001 From: "tien.xuan.vo" Date: Mon, 20 Nov 2023 15:08:20 +0700 Subject: [PATCH 1/2] feat: Apply generators to message's metadata --- rust/pact_ffi/src/models/message.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust/pact_ffi/src/models/message.rs b/rust/pact_ffi/src/models/message.rs index 5098ca02a..257a77a8a 100644 --- a/rust/pact_ffi/src/models/message.rs +++ b/rust/pact_ffi/src/models/message.rs @@ -540,11 +540,13 @@ ffi_fn! { /// If no further data is present, returns NULL. fn pactffi_message_metadata_iter_next(iter: *mut MessageMetadataIterator) -> *mut MessageMetadataPair { let iter = as_mut!(iter); + let generated_metadata; let metadata = match iter.message { Either::Left(message) => { let message = as_ref!(message); - &message.metadata + generated_metadata = block_on(generate_message(message, &GeneratorTestMode::Consumer, &hashmap!{}, &vec![], &hashmap!{})).metadata; + &generated_metadata } Either::Right(contents) => { let contents = as_ref!(contents); From b293ddce296795009a70666c815824996446e07f Mon Sep 17 00:00:00 2001 From: "tien.xuan.vo" Date: Tue, 21 Nov 2023 11:24:27 +0700 Subject: [PATCH 2/2] docs: Update safety comment for pactffi_message_metadata_iter_next --- rust/pact_ffi/src/models/message.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rust/pact_ffi/src/models/message.rs b/rust/pact_ffi/src/models/message.rs index 257a77a8a..2e6392b59 100644 --- a/rust/pact_ffi/src/models/message.rs +++ b/rust/pact_ffi/src/models/message.rs @@ -534,6 +534,8 @@ ffi_fn! { /// # Safety /// /// The underlying data must not change during iteration. + /// This function must only ever be called from a foreign language. Calling it from a Rust function + /// that has a Tokio runtime in its call stack can result in a deadlock. /// /// # Error Handling ///