Replace ExchangeCore with DistributePact - #711
Conversation
This removes a bunch of now redundant code. Signed-off-by: Moritz Hoffmann <antiguru@gmail.com>
frankmcsherry
left a comment
There was a problem hiding this comment.
I'm good with this, though also the pub type things tripped me up when I was trying to use an alias for DistributorPact. Like, it was hard to use because you can't use an alias everywhere you can use a type. I don't think I use Exchange or ExchangeCore that often though, but .. we might find out that this is irritating. But I think even in that case, a new struct that just wraps things to present as a new type would be fine, and still a simplification. No rush to do it, until we need it, though.
|
|
||
| /// An exchange between multiple observers by data | ||
| pub struct ExchangeCore<CB, F> { hash_func: F, phantom: PhantomData<CB> } | ||
| pub type ExchangeCore<CB, F> = DistributorPact<Box<dyn FnOnce(usize) -> DrainContainerDistributor<CB, F>>>; |
There was a problem hiding this comment.
A thing I'm uncertain about, but maybe it's fine, is that when I did pub type Foo = DistributorPact; I didn't have the ability to use Foo as a constructor, like let x = Foo(bar);. I'm not entirely certain when type aliases can be used and cannot, and we might find out that this alias results in making it harder to use ExchangeCore if you need to invoke DistributorPact instead. Maybe it's fine though, and I'm inventing problems that don't exist.
This removes a bunch of now redundant code.