pub struct CompletionEntry {
pub user_data: u64,
pub result: i32,
pub flags: u32,
}Expand description
Completion queue entry 完成队列条目
Represents a completed I/O operation returned from the kernel. 表示从内核返回的已完成的I/O操作。
Fields§
§user_data: u64User data from the corresponding submission / 来自相应提交的用户数据
result: i32Result code: positive = bytes transferred, negative = error code 结果码:正数=传输的字节数,负数=错误码
flags: u32Operation flags / 操作标志
Implementations§
Source§impl CompletionEntry
impl CompletionEntry
Sourcepub const fn new(user_data: u64, result: i32, flags: u32) -> Self
pub const fn new(user_data: u64, result: i32, flags: u32) -> Self
Create a new completion entry 创建新的完成条目
Sourcepub const fn is_success(self) -> bool
pub const fn is_success(self) -> bool
Check if the operation succeeded 检查操作是否成功
Sourcepub const fn bytes_transferred(self) -> Option<u32>
pub const fn bytes_transferred(self) -> Option<u32>
Get the number of bytes transferred 获取传输的字节数
Returns None if the operation failed.
如果操作失败则返回 None。
Sourcepub const fn error_code(self) -> Option<i32>
pub const fn error_code(self) -> Option<i32>
Get the error code if the operation failed 如果操作失败,获取错误码
Sourcepub fn into_result(self) -> Result<u32>
pub fn into_result(self) -> Result<u32>
Convert the result to a std::io::Result
将结果转换为 std::io::Result
Returns Ok(bytes_transferred) on success, Err(error) on failure.
成功返回 Ok(bytes_transferred),失败返回 Err(error)。
Trait Implementations§
Source§impl Clone for CompletionEntry
impl Clone for CompletionEntry
Source§fn clone(&self) -> CompletionEntry
fn clone(&self) -> CompletionEntry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for CompletionEntry
Auto Trait Implementations§
impl Freeze for CompletionEntry
impl RefUnwindSafe for CompletionEntry
impl Send for CompletionEntry
impl Sync for CompletionEntry
impl Unpin for CompletionEntry
impl UnsafeUnpin for CompletionEntry
impl UnwindSafe for CompletionEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more