pub trait PluginInstance:
Debug
+ Send
+ Sync {
Show 18 methods
// Required methods
fn manifest(&self) -> &PactPluginManifest;
fn instance_id(&self) -> &str;
fn has_capability(&self, capability: &str) -> bool;
fn compare_contents<'life0, 'async_trait>(
&'life0 self,
request: CompareContentsRequest,
) -> Pin<Box<dyn Future<Output = Result<CompareContentsResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn configure_interaction<'life0, 'async_trait>(
&'life0 self,
request: ConfigureInteractionRequest,
) -> Pin<Box<dyn Future<Output = Result<ConfigureInteractionResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn generate_content<'life0, 'async_trait>(
&'life0 self,
request: GenerateContentRequest,
) -> Pin<Box<dyn Future<Output = Result<GenerateContentResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn start_mock_server<'life0, 'async_trait>(
&'life0 self,
request: StartMockServerRequest,
) -> Pin<Box<dyn Future<Output = Result<StartMockServerResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn shutdown_mock_server<'life0, 'async_trait>(
&'life0 self,
request: ShutdownMockServerRequest,
) -> Pin<Box<dyn Future<Output = Result<ShutdownMockServerResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_mock_server_results<'life0, 'async_trait>(
&'life0 self,
request: MockServerRequest,
) -> Pin<Box<dyn Future<Output = Result<MockServerResults>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn prepare_interaction_for_verification<'life0, 'async_trait>(
&'life0 self,
request: VerificationPreparationRequest,
) -> Pin<Box<dyn Future<Output = Result<VerificationPreparationResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn verify_interaction<'life0, 'async_trait>(
&'life0 self,
request: VerifyInteractionRequest,
) -> Pin<Box<dyn Future<Output = Result<VerifyInteractionResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_catalogue<'life0, 'async_trait>(
&'life0 self,
request: Catalogue,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn kill(&self) { ... }
fn compare_contents_with_chain<'life0, 'life1, 'async_trait>(
&'life0 self,
request: CompareContentsRequest,
chain_id: &'life1 str,
deadline_ms: u64,
) -> Pin<Box<dyn Future<Output = Result<CompareContentsResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn generate_content_with_chain<'life0, 'life1, 'async_trait>(
&'life0 self,
request: GenerateContentRequest,
chain_id: &'life1 str,
deadline_ms: u64,
) -> Pin<Box<dyn Future<Output = Result<GenerateContentResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn start_mock_server_v2<'life0, 'async_trait>(
&'life0 self,
request: StartMockServerRequest,
) -> Pin<Box<dyn Future<Output = Result<StartMockServerResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn prepare_interaction_for_verification_v2<'life0, 'async_trait>(
&'life0 self,
request: VerificationPreparationRequest,
) -> Pin<Box<dyn Future<Output = Result<VerificationPreparationResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn verify_interaction_v2<'life0, 'async_trait>(
&'life0 self,
request: VerifyInteractionRequest,
) -> Pin<Box<dyn Future<Output = Result<VerifyInteractionResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Trait for a running plugin instance.
Implementations include crate::grpc_plugin::GrpcPactPlugin for exec-type plugins
that communicate via gRPC, and future embedded runtimes (Lua, Python, …).
Required Methods§
Sourcefn manifest(&self) -> &PactPluginManifest
fn manifest(&self) -> &PactPluginManifest
Return the manifest for this plugin.
Sourcefn instance_id(&self) -> &str
fn instance_id(&self) -> &str
Return the instance ID assigned to this plugin at startup.
Sourcefn has_capability(&self, capability: &str) -> bool
fn has_capability(&self, capability: &str) -> bool
Check whether the plugin declared a specific capability.
Sourcefn compare_contents<'life0, 'async_trait>(
&'life0 self,
request: CompareContentsRequest,
) -> Pin<Box<dyn Future<Output = Result<CompareContentsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn compare_contents<'life0, 'async_trait>(
&'life0 self,
request: CompareContentsRequest,
) -> Pin<Box<dyn Future<Output = Result<CompareContentsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a compare contents request to the plugin process
Sourcefn configure_interaction<'life0, 'async_trait>(
&'life0 self,
request: ConfigureInteractionRequest,
) -> Pin<Box<dyn Future<Output = Result<ConfigureInteractionResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn configure_interaction<'life0, 'async_trait>(
&'life0 self,
request: ConfigureInteractionRequest,
) -> Pin<Box<dyn Future<Output = Result<ConfigureInteractionResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a configure contents request to the plugin process
Sourcefn generate_content<'life0, 'async_trait>(
&'life0 self,
request: GenerateContentRequest,
) -> Pin<Box<dyn Future<Output = Result<GenerateContentResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn generate_content<'life0, 'async_trait>(
&'life0 self,
request: GenerateContentRequest,
) -> Pin<Box<dyn Future<Output = Result<GenerateContentResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a generate content request to the plugin
Sourcefn start_mock_server<'life0, 'async_trait>(
&'life0 self,
request: StartMockServerRequest,
) -> Pin<Box<dyn Future<Output = Result<StartMockServerResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start_mock_server<'life0, 'async_trait>(
&'life0 self,
request: StartMockServerRequest,
) -> Pin<Box<dyn Future<Output = Result<StartMockServerResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start a mock server
Sourcefn shutdown_mock_server<'life0, 'async_trait>(
&'life0 self,
request: ShutdownMockServerRequest,
) -> Pin<Box<dyn Future<Output = Result<ShutdownMockServerResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown_mock_server<'life0, 'async_trait>(
&'life0 self,
request: ShutdownMockServerRequest,
) -> Pin<Box<dyn Future<Output = Result<ShutdownMockServerResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Shutdown a running mock server
Sourcefn get_mock_server_results<'life0, 'async_trait>(
&'life0 self,
request: MockServerRequest,
) -> Pin<Box<dyn Future<Output = Result<MockServerResults>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_mock_server_results<'life0, 'async_trait>(
&'life0 self,
request: MockServerRequest,
) -> Pin<Box<dyn Future<Output = Result<MockServerResults>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the matching results from a running mock server
Sourcefn prepare_interaction_for_verification<'life0, 'async_trait>(
&'life0 self,
request: VerificationPreparationRequest,
) -> Pin<Box<dyn Future<Output = Result<VerificationPreparationResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn prepare_interaction_for_verification<'life0, 'async_trait>(
&'life0 self,
request: VerificationPreparationRequest,
) -> Pin<Box<dyn Future<Output = Result<VerificationPreparationResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Prepare an interaction for verification.
Sourcefn verify_interaction<'life0, 'async_trait>(
&'life0 self,
request: VerifyInteractionRequest,
) -> Pin<Box<dyn Future<Output = Result<VerifyInteractionResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn verify_interaction<'life0, 'async_trait>(
&'life0 self,
request: VerifyInteractionRequest,
) -> Pin<Box<dyn Future<Output = Result<VerifyInteractionResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the verification for the interaction.
Provided Methods§
Sourcefn kill(&self)
fn kill(&self)
Terminate the running plugin. The default no-op suits embedded runtimes that are not managed as a child process.
Sourcefn compare_contents_with_chain<'life0, 'life1, 'async_trait>(
&'life0 self,
request: CompareContentsRequest,
chain_id: &'life1 str,
deadline_ms: u64,
) -> Pin<Box<dyn Future<Output = Result<CompareContentsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn compare_contents_with_chain<'life0, 'life1, 'async_trait>(
&'life0 self,
request: CompareContentsRequest,
chain_id: &'life1 str,
deadline_ms: u64,
) -> Pin<Box<dyn Future<Output = Result<CompareContentsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a compare contents request to the plugin process, propagating call-chain cycle
detection and deadline metadata (see crate::call_chain) for transports that support it.
The default implementation ignores chain_id/deadline_ms and delegates to
PluginInstance::compare_contents, which suits in-process runtimes (Lua, WASM) where a
cycle is already caught by the native call stack; crate::grpc_plugin::GrpcPactPlugin
overrides this to send the metadata over gRPC.
Sourcefn generate_content_with_chain<'life0, 'life1, 'async_trait>(
&'life0 self,
request: GenerateContentRequest,
chain_id: &'life1 str,
deadline_ms: u64,
) -> Pin<Box<dyn Future<Output = Result<GenerateContentResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate_content_with_chain<'life0, 'life1, 'async_trait>(
&'life0 self,
request: GenerateContentRequest,
chain_id: &'life1 str,
deadline_ms: u64,
) -> Pin<Box<dyn Future<Output = Result<GenerateContentResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a generate content request to the plugin, propagating call-chain cycle detection and
deadline metadata (see crate::call_chain) for transports that support it. See
PluginInstance::compare_contents_with_chain for the default/override split.
Sourcefn start_mock_server_v2<'life0, 'async_trait>(
&'life0 self,
request: StartMockServerRequest,
) -> Pin<Box<dyn Future<Output = Result<StartMockServerResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start_mock_server_v2<'life0, 'async_trait>(
&'life0 self,
request: StartMockServerRequest,
) -> Pin<Box<dyn Future<Output = Result<StartMockServerResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start a mock server using V2 structured interaction data (no pact JSON).
Sourcefn prepare_interaction_for_verification_v2<'life0, 'async_trait>(
&'life0 self,
request: VerificationPreparationRequest,
) -> Pin<Box<dyn Future<Output = Result<VerificationPreparationResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn prepare_interaction_for_verification_v2<'life0, 'async_trait>(
&'life0 self,
request: VerificationPreparationRequest,
) -> Pin<Box<dyn Future<Output = Result<VerificationPreparationResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Prepare an interaction for verification using V2 structured interaction data.
Sourcefn verify_interaction_v2<'life0, 'async_trait>(
&'life0 self,
request: VerifyInteractionRequest,
) -> Pin<Box<dyn Future<Output = Result<VerifyInteractionResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn verify_interaction_v2<'life0, 'async_trait>(
&'life0 self,
request: VerifyInteractionRequest,
) -> Pin<Box<dyn Future<Output = Result<VerifyInteractionResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the verification for the interaction using V2 structured interaction data.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".