Type Alias zebra_test::mock_service::ProxyItem
source · type ProxyItem<Request, Response, Error> = Arc<Mutex<Option<ResponseSender<Request, Response, Error>>>>;
Expand description
An internal type representing the item that’s sent in the [broadcast
] channel.
The actual type that matters is the ResponseSender
but since there could be more than one
MockService
verifying requests, the type must be wrapped so that it can be shared by all
receivers:
- The
Arc
makes sure the instance is on the heap, and can be shared properly between threads and dropped when no longer needed. - The [
Mutex
] ensures only oneMockService
instance can reply to the received request. - The
Option
forces theMockService
that handles the request to take ownership of it because sending a response also forces theResponseSender
to be dropped.
Aliased Type§
struct ProxyItem<Request, Response, Error> { /* private fields */ }