Usage
Use the generate_svc! macro to generate a mock server with type-safe RPC methods:
use ;
use Code;
generate_svc!
async
Custom Server Name
You can specify a custom name for the generated server using as:
generate_svc!
let server = start_default.await;
Combining with Headers
server.setup;
String-based API
⚠️ Deprecated: Use the type-safe API instead. String-based API is there for backward compatibility but will be removed in the future.
You can also use the string-based API for paths:
server.setup;
What the Macro Generates
The generate_svc! macro generates:
{ServiceName}MockServer(or custom name) - the mock server struct withstart_default(),start(port), andstart_with_addr(addr)methods{ServiceName}TypeSafeExttrait - extension trait forWhenBuilderwithpath_{method_name}methods
Project Structure
- wiremock-grpc/ - Main crate published to crates.io
- wiremock-grpc-macros/ - Proc macro crate for type-safe RPC methods. You do not need to depend on it directly.