I have created a SplitSink<WebSocketStream<MaybeTlsStream<TcpStream>>, Message> via
let (write, read) = ws_stream.split();
How can I see which methods are available for write? The documentation for SplitSink doesn’t actually list any methods: it just lists a long list of traits, and I have to click on each and every one of them?
How can I simply find out how to write to it?
>Solution :
Assuming you’re talking about this SplitSink, I see three "interesting" traits on that page. There’s Debug, Sink, and Unpin.
The "Auto Trait Implementations" section is for things like Send and Sync that the compiler implements for you, and "Blanket Implementations" are (usually trivial) implementations defined for all types of a particular class. For instance, one of the blanket implementations listed is impl From<SplitSink> for SplitSink (generic arguments omitted for simplicity) which says "If I have a SplitSink, I can convert it into a SplitSink". This doesn’t say anything specific about a SplitSink, it’s just a property a lot of types (in this case, all types) have in Rust, and SplitSink happens to be an example.
So only three are written specifically for this type. Of those, Debug is for debugging, naturally, and involves printing the object’s innards to the screen. Unpin is a more complicated move-semantics trick you can read about here, but it’s a borrow semantics thing, not a capability of the type itself in terms of the public API you’re probably looking for. So that just leaves Sink, which looks like it has several ways to send data to a Sink.