You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can we turn impl Buf into a namable type (BufList<B>)? It is nice to use impl Buf and all, but today it makes it impossible to use it as a trait associated type.
Example:
traitBufferer{typeData: bytes::Buf;// ...}impl<B>BuffererforCollected<B>{typeData = ?;// can't just `impl Buf` now}
The text was updated successfully, but these errors were encountered:
Yes, it is unnameable. It should eventually be possible to use ATPIT, and in the meantime it's possible to box the type, or convert it into a different one (like copy_to_bytes).
Thx for the reply! Yep, both solutions work. I can't decide for myself which one to use now, so I now have an overengineered a solution on my end of the code to support both variants...
Can I ask why is the API like this in the first place? It is quite obvious doing this today before rust fully support referring to existential types creates a needless burden for the end user. There is an obvious solution to the problem - that is to just use a nameable type there. Not sure what is the benefit here, but it does make people waste time working around this issue.
UPD: also, should I make a PR to change the impl Buf to a named type?
Can we turn
impl Buf
into a namable type (BufList<B>
)? It is nice to useimpl Buf
and all, but today it makes it impossible to use it as a trait associated type.Example:
The text was updated successfully, but these errors were encountered: