websockets-rs / rust-websocket

A WebSocket (RFC6455) library written in Rust
http://websockets-rs.github.io/rust-websocket/
MIT License
1.55k stars 223 forks source link

#[derive(Debug)] (or impl Debug) for websocket::server::InvalidConnection<tokio_core::net::TcpStream, bytes::bytes::BytesMut> #153

Closed Kixunil closed 5 years ago

Kixunil commented 6 years ago

Currently one can not use unwrap() on the result in order to quickly prototype.

   = note: the method `unwrap` exists but the following trait bounds were not satisfied:
           `websocket::server::InvalidConnection<tokio_core::net::TcpStream, bytes::bytes::BytesMut> : std::fmt::Debug`
illegalprime commented 6 years ago

@Kixunil unfortunately this cannot have Debug in it because TcpStream does not implement Debug. Would simply having a custom implementation that says TcpStream -> "TcpStream" be OK?

Kixunil commented 6 years ago

Sure. It may also skip TcpStream entirely or provide address. Having information about why something failed is what's needed.