pub fn join_session(&mut self, session_token: impl Into<u16>) -> io::Result<u8> {
        let be_bytes = session_token.into().to_be_bytes();

        let buffer = [b'J', b'o', b'i', b'n', be_bytes[0], be_bytes[1]];

        self.stream.write(&buffer)?;

        let mut buffer = [0u8; 1];

        if self.stream.read(&mut buffer)? < 1 {
            return Err(Error::new(
                ErrorKind::ConnectionAborted,
                "Couldn't Join Session.",
            ));
        }

        Ok(buffer[0])
    }
/// It'll join an already existing session and return the position of the player.
It'll join an already existing session and return the position of the player.
It ' ll join an already existing session and return the position of the player .
pub fn join_session(&mut self, session_token: impl Into<u16>) -> io::Result<u8> {
        let be_bytes = session_token.into().to_be_bytes();
        let buffer = [b'J', b'o', b'i', b'n', be_bytes[0], be_bytes[1]];
        self.stream.write(&buffer)?;
        let mut buffer = [0u8; 1];
        if self.stream.read(&mut buffer)? < 1 {
            return Err(Error::new(
                ErrorKind::ConnectionAborted,
                "Couldn't Join Session.",
            ));
        }
        Ok(buffer[0])
    }
pub fn join_session ( & mut self , session_token : impl Into < u16 > ) -> io :: Result < u8 > { let be_bytes = session_token . into ( ) . to_be_bytes ( ) ; let buffer = [ b'J' , b'o' , b'i' , b'n' , be_bytes [ 0 ] , be_bytes [ 1 ] ] ; self . stream . write ( & buffer ) ? ; let mut buffer = [ 0u8 ; 1 ] ; if self . stream . read ( & mut buffer ) ? < 1 { return Err ( Error :: new ( ErrorKind :: ConnectionAborted , " " , ) ) ; } Ok ( buffer [ 0 ] ) }
It'll join an already existing session and return the position of the player.
It ' ll join an already existing session and return the position of the player .
&mut self
session_token
impl Into<u16>
&mut self
session_token
impl Into<u16>