pub fn new(id: BytesMut, session: Arc<Mutex<Session>>, client: Client) -> Entity {
        // Cache the `SocketAddr` and create a channel to communicate with.
        let addr = client.peer_addr().unwrap();
        let entity_key = id.clone().freeze();
        let entity_id = id.clone().freeze();
        let (tx, rx) = mpsc::unbounded();

        // Add an entry for this `Entity` in the shared session map.
        let is_master = session.lock().unwrap().add_entity(addr, &entity_key, tx);

        Entity {
            addr,
            client,
            id: entity_id,
            is_master: is_master,
            rx,
            session,
        }
    }
/// Create a new `Entity` given all required fields.
Create a new `Entity` given all required fields.
Create a new ` Entity ` given all required fields .
pub fn new(id: BytesMut, session: Arc<Mutex<Session>>, client: Client) -> Entity {
        // Cache the `SocketAddr` and create a channel to communicate with.
        let addr = client.peer_addr().unwrap();
        let entity_key = id.clone().freeze();
        let entity_id = id.clone().freeze();
        let (tx, rx) = mpsc::unbounded();
        // Add an entry for this `Entity` in the shared session map.
        let is_master = session.lock().unwrap().add_entity(addr, &entity_key, tx);
        Entity {
            addr,
            client,
            id: entity_id,
            is_master: is_master,
            rx,
            session,
        }
    }
pub fn new ( id : BytesMut , session : Arc < Mutex < Session > > , client : Client ) -> Entity { // Cache the `SocketAddr` and create a channel to communicate with. let addr = client . peer_addr ( ) . unwrap ( ) ; let entity_key = id . clone ( ) . freeze ( ) ; let entity_id = id . clone ( ) . freeze ( ) ; let ( tx , rx ) = mpsc :: unbounded ( ) ; // Add an entry for this `Entity` in the shared session map. let is_master = session . lock ( ) . unwrap ( ) . add_entity ( addr , & entity_key , tx ) ; Entity { addr , client , id : entity_id , is_master : is_master , rx , session , } }
Create a new `Entity` given all required fields.
Create a new ` Entity ` given all required fields .
id
BytesMut
session
Arc<Mutex<Session>>
client
Client
id
BytesMut
session
Arc<Mutex<Session>>
client
Client