/**
 * Check if memory key is valid
 */
Check if memory key is valid
Check if memory key is valid
pub fn validate_memory_key_format(key: &str) -> Result<(), EngineError> {
    if !key.chars().all(|c| c.is_alphanumeric() || c == '_') {
        return Err(EngineError::Format(ERROR_KEY_ALPHANUMERIC.to_owned()));
    }
    if key.len() > std::u8::MAX as usize {
        return Err(EngineError::Format(ERROR_SIZE_IDENT.to_owned()));
    }
    if key.parse::<f64>().is_ok() {
        return Err(EngineError::Format(ERROR_NUMBER_AS_KEY.to_owned()));
    }
    Ok(())
}
pub fn validate_memory_key_format ( key : & str ) -> Result < ( ) , EngineError > { if ! key . chars ( ) . all ( | c | c . is_alphanumeric ( ) || c == '_' ) { return Err ( EngineError :: Format ( ERROR_KEY_ALPHANUMERIC . to_owned ( ) ) ) ; } if key . len ( ) > std :: u8 :: MAX as usize { return Err ( EngineError :: Format ( ERROR_SIZE_IDENT . to_owned ( ) ) ) ; } if key . parse :: < f64 > ( ) . is_ok ( ) { return Err ( EngineError :: Format ( ERROR_NUMBER_AS_KEY . to_owned ( ) ) ) ; } Ok ( ( ) ) }
Check if memory key is valid
Check if memory key is valid
key
&str