-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Further trait reorganization #427
Further trait reorganization #427
Conversation
Oh oops, it also adds a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine!
inner: Vec::with_capacity(size), | ||
} | ||
} | ||
fn reserve(&mut self, _additional: usize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to @antiguru: we could have a slightly better implementation here to pre-size the local part of self, but I can't recall the available apis out of my head.
} | ||
|
||
// The `ToOwned` requirement exists to satisfy `self.reserve_items`, who must for now | ||
// be presented with the actual contained type, rather than a type that borrows into it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should revisit the type requirements on region and timely stack!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right! I'm not sure if it really helps here, but e.g. if I have a bunch of Vec<u8>
and you are able to only maintain [u8]
shaped data, that could help. Or we could conclude that this type does not do that, and not be too stressed! :D
This PR moves
BatchContainer
andOrdOffset
out of thelayers
module which is specific to Trie implementations, and in to theimplementations
module, which seems more appropriate.It also experiments a bit with the
BatchContainer
trait, allowingItem
to be unsized, and supportingpush
andcopy_slice
only whenT: ToOwned
. This is .. unfortunately a restriction rather than a pure generalization; to implementToOwned
you have to be able to clone yourself, even though we don't need this.Up for discussion, but I think based on the vibes around containers, and their non-ownership-providing nature, this might be ok.
cc: @antiguru