Skip to content

Commit

Permalink
Merge pull request #341 from tienvx/generate-message-metadata
Browse files Browse the repository at this point in the history
feat: Apply generators to message's metadata
  • Loading branch information
rholshausen authored Nov 21, 2023
2 parents 755909b + b293ddc commit 01ccc4f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rust/pact_ffi/src/models/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,17 +534,21 @@ 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
///
/// 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);
Expand Down

0 comments on commit 01ccc4f

Please sign in to comment.