Closed sebpuetz closed 2 years ago
I think Option<SocketAddr>
solution that you mentioned in #33 is the best approach.
In my opinion, there is no need to introduce a Builder
if it can be avoided.
Your call, but this doesn't really introduce a builder, the builder is already present as the Server
struct. My PR renames it and splits Server::serve()
into two stages:
That's motivated by a cleaner separation between setup (currently done via Server::acceptor()
, etc.) and runtime (currently Server::serve()
). If an Ok(Server)
is returned from serve()
, the server has been built succesfully and can start serving connections by awaiting it.
It also helps with clarifying the API, currently it's a bit confusing because Server::bind()
only configures the builder while the serve()
call actually binds the socket, builds the actual server and returns the future to run it.
Good point. I am currently busy though. I will take a look at it later.
See #42.
This takes a slightly different approach to what you suggested in #33, just wanted to get some quick feedback whether you think this would also be a good solution.
The main idea is to split up the builder from the actual server struct and bundle the server future together with the actually bound address.