tonarino / actor

A minimalist actor framework aiming for high performance and simplicity.
MIT License
40 stars 6 forks source link

Actor: factor out Sized bound to the trait itself #18

Closed strohel closed 3 years ago

strohel commented 3 years ago

All Actor trait methods had a Sized bound. It should be equivalent to put the bound on the whole trait.

Or perhaps there is some reason not to?

strohel commented 3 years ago

Another option would be to add ?Sized to the generic param of Context and Addr, as they only need Actor::Message to be sized, but not Actor itself. I don't know if one is preferred over the other?

Oh, that's interesting. ?Sized would make the API somewhat more flexible - but I'm unable to come up with a particular use-case. Implementing Actor for dyn OtherTrait?

Perhaps a pragmatic approach is to only add ?Sized when Sized comes out to be restrictive.

skywhale commented 3 years ago

Yeah, I can not really think of unsized actor use case, either. But it may still be good to keep the trait constraint-free until it becomes necessary. Up to you :) I don't feel strongly either way.

strohel commented 3 years ago

I've submitted the alternative proposal in https://github.com/tonarino/actor/pull/25

If nobody has a preference, then let's merge the other one and close this one.