# 错误[E0599]：在当前作用域中未找到 `String` 结构体上的 `parse` 方法

- **ID:** `rust/e0599-no-method-named-parse-found`
- **领域:** rust
- **类别:** type_error
- **错误码:** `E0599`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

在 String 上调用 `.parse()` 时没有导入 `FromStr` trait 或为结果提供类型注解。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.65 | active | — | — |
| 1.70 | active | — | — |
| 1.75 | active | — | — |

## 解决方案

1. ```
   Add a type annotation to the result: `let num: u32 = my_string.parse().unwrap();`
   ```
2. ```
   Use turbofish syntax: `my_string.parse::<u32>().unwrap();`
   ```
3. ```
   Explicitly call `FromStr::from_str`: `u32::from_str(&my_string).unwrap();`
   ```

## 无效尝试

- **Adding `use std::str::FromStr;` but not specifying the target type** — The parse method requires type inference; without a type hint, the compiler cannot determine the output type. (80% 失败率)
- **Using `as` cast: `my_string as u32`** — String cannot be cast to numeric types with `as`; only primitive numeric types can be cast. (95% 失败率)
