tosc-rs / mgnp

MnemOS Global Networking Protocol
Creative Commons Attribution Share Alike 4.0 International
15 stars 1 forks source link

feat(tricky-pipe): add `mpsc::ErasedSender` #39

Closed hawkw closed 10 months ago

hawkw commented 10 months ago

This branch adds new ErasedSender and ErasedPermit types to tricky_pipe::mpsc. These types allow senders to reserve channel capacity for a dynamic type (which may or may not implement Serialize and DeserializeOwned), and then dynamically downcast the ErasedPermit back to a concrete type. This allows performing the asynchronous portion of the send operation (reserving a Permit) in a non-type-erased context, and using a vtable function to actually send the message once the async reserve operation has completed.