-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Return an iterator from clients_id #47
Comments
The problem with returning an iterator is that it would keep a reference to RenetServer, so we would not be able to call: // This would need to be server.clients_id().collect().into_iter() {
for client_id in server.clients_id() {
while let Some(message) = server.receive_message(client_id, channel_id) {
// ...
}
} I could return an owned iterator by creating a new Vec and returning an iterator over it, but at this point, why not just return the Vec. Could also implement a new function just for the iterator I guess. There might be a better way, not sure |
Right, it won't work because of the borrow checker :( |
Although, having |
Added in #91 |
Currently
RenetServer::clients_id()
returnsVec
but it's not very flexible and users usually wants to iterate over them in most cases. So I would suggest to returnimpl Iterator
instead.The text was updated successfully, but these errors were encountered: