pub fn connect(
        &mut self,
        address: &Address,
        channel_count: usize,
        data: u32,
    ) -> Result<(&mut Peer<T>, PeerID), Error> {
        let res: *mut ENetPeer = unsafe {
            enet_host_connect(
                self.inner,
                &address.to_enet_address() as *const _,
                channel_count,
                data,
            )
        };

        if res.is_null() {
            return Err(Error(0));
        }

        Ok((
            Peer::new_mut(unsafe { &mut *res }),
            // We can do pointer arithmetic here to determine the offset of our new Peer in the
            // list of peers, which is it's PeerID.
            unsafe { self.peer_id(res) },
        ))
    }
/// Initiates a connection to a foreign host.
///
/// The connection will not be done until a `Event::Connected` for this peer was received.
///
/// `channel_count` specifies how many channels to allocate for this peer.
/// `data` is a user-specified value that can be chosen arbitrarily.
Initiates a connection to a foreign host.
The connection will not be done until a `Event::Connected` for this peer was received.

`channel_count` specifies how many channels to allocate for this peer.
`data` is a user-specified value that can be chosen arbitrarily.
Initiates a connection to a foreign host . The connection will not be done until a ` Event :: Connected ` for this peer was received . ` channel_count ` specifies how many channels to allocate for this peer . ` data ` is a user - specified value that can be chosen arbitrarily .
pub fn connect(
        &mut self,
        address: &Address,
        channel_count: usize,
        data: u32,
    ) -> Result<(&mut Peer<T>, PeerID), Error> {
        let res: *mut ENetPeer = unsafe {
            enet_host_connect(
                self.inner,
                &address.to_enet_address() as *const _,
                channel_count,
                data,
            )
        };
        if res.is_null() {
            return Err(Error(0));
        }
        Ok((
            Peer::new_mut(unsafe { &mut *res }),
            // We can do pointer arithmetic here to determine the offset of our new Peer in the
            // list of peers, which is it's PeerID.
            unsafe { self.peer_id(res) },
        ))
    }
pub fn connect ( & mut self , address : & Address , channel_count : usize , data : u32 , ) -> Result < ( & mut Peer < T > , PeerID ) , Error > { let res : * mut ENetPeer = unsafe { enet_host_connect ( self . inner , & address . to_enet_address ( ) as * const _ , channel_count , data , ) } ; if res . is_null ( ) { return Err ( Error ( 0 ) ) ; } Ok ( ( Peer :: new_mut ( unsafe { & mut * res } ) , // We can do pointer arithmetic here to determine the offset of our new Peer in the // list of peers, which is it's PeerID. unsafe { self . peer_id ( res ) } , ) ) }
Initiates a connection to a foreign host.
Initiates a connection to a foreign host .
&mut self
address
&Address
channel_count
usize
data
u32
&mut self
address
&Address
channel_count
usize
data
u32