-
Notifications
You must be signed in to change notification settings - Fork 961
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
docs(websocket): showcase wrapping dns and tcp transport #3385
Conversation
Re #3330 (comment) providing impl Default for WsConfig<T: Transport> {
#[cfg(feature = "async-io")]
fn default() -> Self {
WsConfig {
transport: dns::DnsConfig::system(
tcp::async_io::Transport::new(tcp::Config::default()),
)
.await
.unwrap(),
}
}
#[cfg(feature = "tokio")]
fn default() -> Self {
WsConfig {
transport: dns::TokioDnsConfig::system(
tcp::tokio::Transport::new(tcp::Config::default()),
)
}
}
} |
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.
Ready to merge from my end.
Thanks @melekes for making this easier for future users!
Will wait a bit to give @thomaseizinger a chance to reply as well.
There is no async default so we can't do that unfortunately. |
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.
I would still be in favor of dedicated constructors that take the necessary inner configs:
impl WsConfig {
async fn new_wss(dns_config: ..., tcp_config: ...) -> Self {}
fn new_ws(tcp_config: ...) -> Self {}
}
The examples can then move to the docs of these functions.
Happy to merge this too as it is better than what we have today.
Thanks @melekes !
It just feels too cumbersome when I add 4 new methods (2 fn and 2 features: tokio and async-io). I'd be in favor of just merging as is. |
Ah yes, I forgot that we'd have to do one per executor. |
Approvals have been dismissed because the PR was updated after the send-it
label was applied.
Closes #3330