本文簡要介紹rust語言中 std::io::Error.last_os_error
的用法。
用法
pub fn last_os_error() -> Error
返回一個錯誤,表示發生的最後一個操作係統錯誤。
此函數讀取目標平台的 errno
的值(例如 Windows 上的 GetLastError
),並將返回相應的 Error
實例作為錯誤代碼。
例子
use std::io::Error;
println!("last OS error: {:?}", Error::last_os_error());
相關用法
- Rust Error.source用法及代碼示例
- Rust Error.chain用法及代碼示例
- Rust Error.description用法及代碼示例
- Rust Error.kind用法及代碼示例
- Rust Error.from_raw_os_error用法及代碼示例
- Rust Error.get_ref用法及代碼示例
- Rust Error.into_inner用法及代碼示例
- Rust Error.new用法及代碼示例
- Rust Error.get_mut用法及代碼示例
- Rust Error.raw_os_error用法及代碼示例
- Rust Error用法及代碼示例
- Rust Entry.or_insert_with用法及代碼示例
- Rust ExitStatus.code用法及代碼示例
- Rust Eq用法及代碼示例
- Rust Entry.or_insert用法及代碼示例
- Rust ExactSizeIterator.is_empty用法及代碼示例
- Rust Extend.extend用法及代碼示例
- Rust Entry.and_modify用法及代碼示例
- Rust ExitStatusError.code用法及代碼示例
- Rust ExactSizeIterator用法及代碼示例
- Rust ExitStatusError用法及代碼示例
- Rust ExitStatus.exit_ok用法及代碼示例
- Rust Entry.or_insert_with_key用法及代碼示例
- Rust Entry.key用法及代碼示例
- Rust Entry.or_default用法及代碼示例
注:本文由純淨天空篩選整理自rust-lang.org大神的英文原創作品 std::io::Error.last_os_error。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。