-
Notifications
You must be signed in to change notification settings - Fork 13
Description
This is one of my favorite crates but one tiny thing is nagging at me - that heap allocation for Channel! I would like to manage the allocation of the Channel myself and just call something like unsafe fn channel_with_external_storage<T>(channel_ptr: NonNull<Channel<T>>, drop_channel: fn(NonNull<Channel<T>>)) -> (Sender<T>, Receiver<T>) which would let me manage the memory and control what happens on drop.
The goal is to ultimately enable allocation-free scenarios by reusing Channel and/or embedding it inside other objects.
Does this sound feasible? I suppose this would need to be some pub struct ExternalChannel<T> { real_channel: Channel<T> } to hide any details of the channel object and just let the caller provide storage for it.
WDYT? I can try come up with a pull request at some point if it sounds like a feature that would be a good fit for this crate.