Description
For example, when my mouse cursor is above the std::net::TcpListener
in my code, I get this in the "tooltip":
std::net::tcp
pub struct TcpListener // size = 4, align = 4
A TCP socket server, listening for connections.
After creating a TcpListener by [bind]ing it to a socket address, it listens for incoming TCP connections. These can be accepted by calling [accept] or by iterating over the [Incoming](vscode-file://vscode-app/opt/visual-studio-code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html) iterator returned by [incoming](vscode-file://vscode-app/opt/visual-studio-code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html).
The socket will be closed when the value is dropped.
The Transmission Control Protocol is specified in [IETF RFC 793](vscode-file://vscode-app/opt/visual-studio-code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html).
Examples
use std::net::{TcpListener, TcpStream};
fn handle_client(stream: TcpStream) {
// ...
}
fn main() -> std::io::Result<()> {
let listener = TcpListener::bind("127.0.0.1:80")?;
// accept connections and process them serially
for stream in listener.incoming() {
handle_client(stream?);
}
Ok(())
}
[10 implementations](vscode-file://vscode-app/opt/visual-studio-code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html)
This is all fine and dandy; however, it would also be really useful if all the trait implementations were shown for this type, close to the full path to the type in the first line. The size and alignment are both great, but having the traits implemented listed would be a more useful thing, in my opinion. Especially it would be helpful since many crates provide trait implementations during the code generation stage, so it is really hard to find out if a certain trait is implemented for the type or not, as what you see in the code is some macro magic with many different conditions, where you might not know which one is truth and so, leads to some trait being implemented for this type.