Skip to main content

BufResult

Type Alias BufResult 

Source
pub type BufResult<T, B> = (Result<T>, B);
Expand description

Result type for operations that return both a result and a buffer.

This is commonly used for read/write operations where the buffer is returned along with the operation result. The buffer is always returned regardless of success or failure.

ยงExample

use lio::BufResult;

// Simulating an I/O result that returns the buffer
let buf = vec![0u8; 1024];
let result: BufResult<usize, Vec<u8>> = (Ok(512), buf);

let (io_result, returned_buf) = result;
assert_eq!(io_result.unwrap(), 512);
assert_eq!(returned_buf.len(), 1024);