Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::net::TcpStream;
- struct Client {
- stream: TcpStream,
- server: Server,
- }
- impl Client {
- fn test(&self){
- server.broadcast();
- }
- }
- struct Server {
- conns: Vec<Client>,
- }
- impl Server {
- fn add_conn(&mut self, stream: TcpStream){
- // do stuff
- self.conns.push(Client { stream: stream, server: /* What do I do here? */ });
- }
- fn broadcast(&self){
- for conn in conns{
- // do stuff
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement