How to bypass calling of methods of an implemented trait to a field of the struct


#1

please consider the following example:

struct NewStream {
    stream: TcpStream,
    ...
}

impl Read for NewStream {
    ...
}

as you know TcpStream implements Read trait, is it possible to bypass (!!!) calling of all Read methods to stream field without explicitly defining those methods for NewStream and calling the corresponding methods of stream field inside that defined method?


#2

It’s not possible yet, but delegation like this is a frequent request, e.g. 2 days ago: