What are the fields of TcpStream structure?


#1

TcpStream is the name of a struct. In the documentation i find:

pub struct TcpStream(_);

  1. I do not understand the parameter underscore.
  2. How can i find the fields of this struct?

#2

The fields are private, you can’t access them from your code. The underscore indicates that they have been omitted. You must interact with the TcpStream type through its methods and associated functions.


#3

Can i see them in some library, where they are declaired private to that library?


#4

You can always read the code: https://doc.rust-lang.org/src/std/net/tcp.rs.html#55


#5

To add a little more context to @jer’s reply - when you’re looking at the docs for an item, you can always click the ‘src’ link on the right to jump to a view of the actual definition: