Struct std::num::ParseIntError 1.0.0[−][src]
pub struct ParseIntError { /* fields omitted */ }Expand description
解析整数时可以返回的错误。
此错误用作原始整数类型 (例如 i8::from_str_radix) 上 from_str_radix() 函数的错误类型。
潜在原因
除其他原因外,例如,当从标准输入中获取 ParseIntError 时,可能会由于字符串中的前导或尾随空格而抛出 ParseIntError。
使用 str::trim() 方法可确保在解析之前不留空格。
Example
if let Err(e) = i32::from_str_radix("a12", 10) {
println!("Failed conversion to i32: {}", e);
}RunImplementations
输出解析整数失败的详细原因。
Trait Implementations
👎 Deprecated since 1.42.0:
use the Display impl or to_string()
此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more
此方法测试 !=。