Generic Callbacks in Rust
-
3 mins read
In a recent project, we developed an ingestion pipeline in Rust. We wanted to execute asynchronous tasks in response to messages received from SQS, as a subscriber. Our goal was to leverage Rust generics to allow the subscriber to take ownership of the payload schema and the pipeline implementation details. This approach enables the separation of the SQS subscription logic from the subscriber’s responsibilities, promoting of cleaner separation of concerns. It also facilitates independent testing of both components, ensuring they can be assessed in isolation.