pub fn new(data: &[u8], mode: PacketMode) -> Result<Packet, Error> {
        let res = unsafe {
            enet_packet_create(data.as_ptr() as *const _, data.len(), mode.to_sys_flags())
        };

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

        Ok(Packet::from_sys_packet(res))
    }
/// Creates a new Packet with optional reliability settings.
Creates a new Packet with optional reliability settings.
Creates a new Packet with optional reliability settings .
pub fn new(data: &[u8], mode: PacketMode) -> Result<Packet, Error> {
        let res = unsafe {
            enet_packet_create(data.as_ptr() as *const _, data.len(), mode.to_sys_flags())
        };
        if res.is_null() {
            return Err(Error(0));
        }
        Ok(Packet::from_sys_packet(res))
    }
pub fn new ( data : & [ u8 ] , mode : PacketMode ) -> Result < Packet , Error > { let res = unsafe { enet_packet_create ( data . as_ptr ( ) as * const _ , data . len ( ) , mode . to_sys_flags ( ) ) } ; if res . is_null ( ) { return Err ( Error ( 0 ) ) ; } Ok ( Packet :: from_sys_packet ( res ) ) }
Creates a new Packet with optional reliability settings.
Creates a new Packet with optional reliability settings .
data
&[u8]
mode
PacketMode
data
&[u8]
mode
PacketMode