fn add_symbol(&mut self, value: String) -> Result<u32, BindProgramEncodeError> {
        if value.len() > MAX_STRING_LENGTH {
            return Err(BindProgramEncodeError::InvalidStringLength(value));
        }

        let symbol_key = self.unique_key;

        self.encoded_symbols.insert(value.to_string(), self.unique_key);

        // Add the symbol to the bytecode. The string value is followed by a zero
        // terminator.
        self.bytecode.extend_from_slice(&self.unique_key.to_le_bytes());
        self.bytecode.append(&mut value.into_bytes());
        self.bytecode.push(0);

        self.unique_key += 1;

        Ok(symbol_key)
    }
// Assign a unique key to |value| and add it to the list of encoded symbols and
// the bytecode.
// TODO(fxb/67919): Add support for enum values.
Assign a unique key to |value| and add it to the list of encoded symbols and
the bytecode.
TODO(fxb/67919): Add support for enum values.
Assign a unique key to |value| and add it to the list of encoded symbols and the bytecode . TODO ( fxb / 67919 ) : Add support for enum values .
fn add_symbol(&mut self, value: String) -> Result<u32, BindProgramEncodeError> {
        if value.len() > MAX_STRING_LENGTH {
            return Err(BindProgramEncodeError::InvalidStringLength(value));
        }
        let symbol_key = self.unique_key;
        self.encoded_symbols.insert(value.to_string(), self.unique_key);
        // Add the symbol to the bytecode. The string value is followed by a zero
        // terminator.
        self.bytecode.extend_from_slice(&self.unique_key.to_le_bytes());
        self.bytecode.append(&mut value.into_bytes());
        self.bytecode.push(0);
        self.unique_key += 1;
        Ok(symbol_key)
    }
fn add_symbol ( & mut self , value : String ) -> Result < u32 , BindProgramEncodeError > { if value . len ( ) > MAX_STRING_LENGTH { return Err ( BindProgramEncodeError :: InvalidStringLength ( value ) ) ; } let symbol_key = self . unique_key ; self . encoded_symbols . insert ( value . to_string ( ) , self . unique_key ) ; // Add the symbol to the bytecode. The string value is followed by a zero // terminator. self . bytecode . extend_from_slice ( & self . unique_key . to_le_bytes ( ) ) ; self . bytecode . append ( & mut value . into_bytes ( ) ) ; self . bytecode . push ( 0 ) ; self . unique_key += 1 ; Ok ( symbol_key ) }
Assign a unique key to |value| and add it to the list of encoded symbols and
the bytecode.
Assign a unique key to |value| and add it to the list of encoded symbols and the bytecode .
&mut self
value
String
&mut self
value
String