fn try_get_string(&mut self) -> Result<String, TryGetError> {
        let len = self.try_get_var_int();
        if let Ok(len) = len {
            // Check that the client isn't trying
            // to make the server allocate ridiculous
            // amounts of memory
            if len > 32767 {
                return Err(TryGetError::ValueTooLarge);
            }
            let mut result = String::with_capacity(len as usize);
            for _ in 0..len {
                let res = self.try_get_i8()? as u8;
                result.push(res as char);
            }

            return Ok(result);
        }

        Err(TryGetError::NotEnoughBytes)
    }
/// Reads a string from the object.
Reads a string from the object.
Reads a string from the object .
fn try_get_string(&mut self) -> Result<String, TryGetError> {
        let len = self.try_get_var_int();
        if let Ok(len) = len {
            // Check that the client isn't trying
            // to make the server allocate ridiculous
            // amounts of memory
            if len > 32767 {
                return Err(TryGetError::ValueTooLarge);
            }
            let mut result = String::with_capacity(len as usize);
            for _ in 0..len {
                let res = self.try_get_i8()? as u8;
                result.push(res as char);
            }
            return Ok(result);
        }
        Err(TryGetError::NotEnoughBytes)
    }
fn try_get_string ( & mut self ) -> Result < String , TryGetError > { let len = self . try_get_var_int ( ) ; if let Ok ( len ) = len { // Check that the client isn't trying // to make the server allocate ridiculous // amounts of memory if len > 32767 { return Err ( TryGetError :: ValueTooLarge ) ; } let mut result = String :: with_capacity ( len as usize ) ; for _ in 0 .. len { let res = self . try_get_i8 ( ) ? as u8 ; result . push ( res as char ) ; } return Ok ( result ) ; } Err ( TryGetError :: NotEnoughBytes ) }
Reads a string from the object.
Reads a string from the object .
&mut self
&mut self