implement_pass_run¶
- hugr.passes.composable.implement_pass_run(composable_pass: ComposablePass, *, hugr: Hugr, inplace: bool, inplace_call: Callable[[Hugr], PassResult] | None = None, copy_call: Callable[[Hugr], PassResult] | None = None) PassResult[source]¶
Helper function to implement a ComposablePass.run method, given an inplace or copy-returning pass method.
At least one of the inplace_call or copy_call arguments must be provided.
- Parameters:
composable_pass – The pass being run. Used for error messages.
hugr – The Hugr to apply the pass to.
inplace – Whether to apply the pass inplace.
inplace_call – The method to apply the pass inplace.
copy_call – The method to apply the pass by copying the Hugr.
- Returns:
The result of the pass application.
- Raises:
ValueError – If neither inplace_call nor copy_call is provided.