pub struct WriteRequest {
pub allocation: BufPoolAllocation,
pub slot_index: usize,
}Expand description
A write operation submitted to WritePipe
The request contains the buffers to persist along with the destination slot index in the
underlying [FrozenFile].
§Example
use frozen_core::{bufpool, utils, wpipe};
use std::ptr;
const BUFFER_SIZE: utils::BufferSize = utils::BufferSize::S128;
let pool_cfg = bufpool::BufPoolCfg {
buffer_size: utils::BufferSize::S128,
max_memory: 0x400 * BUFFER_SIZE as usize,
};
let pool = bufpool::BufPool::new(pool_cfg);
let payload = vec![0x0A; BUFFER_SIZE as usize];
let allocation = pool.allocate(1);
unsafe {ptr::copy_nonoverlapping(
payload.as_ptr(),
allocation.first(),
payload.len()
)};
let request = wpipe::WriteRequest {allocation, slot_index: 0};
assert!(request.slot_index >= 0);Fields§
§allocation: BufPoolAllocationBuffer allocation containing the pages to be written allocated using bufpool::BufPool
§Example
use frozen_core::{bufpool, utils, wpipe};
use std::ptr;
const BUFFER_SIZE: utils::BufferSize = utils::BufferSize::S128;
let pool_cfg = bufpool::BufPoolCfg {
buffer_size: utils::BufferSize::S128,
max_memory: 0x400 * BUFFER_SIZE as usize,
};
let pool = bufpool::BufPool::new(pool_cfg);
let payload = vec![0x0A; BUFFER_SIZE as usize];
let allocation = pool.allocate(1);
unsafe {ptr::copy_nonoverlapping(
payload.as_ptr(),
allocation.first(),
payload.len()
)};
let request = wpipe::WriteRequest {allocation, slot_index: 0};
assert!(!request.allocation.first().is_null());slot_index: usizeDestination slot index where the pages of the allocation will be written from
§Example
use frozen_core::{bufpool, utils, wpipe};
use std::ptr;
const BUFFER_SIZE: utils::BufferSize = utils::BufferSize::S128;
let pool_cfg = bufpool::BufPoolCfg {
buffer_size: utils::BufferSize::S128,
max_memory: 0x400 * BUFFER_SIZE as usize,
};
let pool = bufpool::BufPool::new(pool_cfg);
let payload = vec![0x0A; BUFFER_SIZE as usize];
let allocation = pool.allocate(1);
unsafe {ptr::copy_nonoverlapping(
payload.as_ptr(),
allocation.first(),
payload.len()
)};
let request = wpipe::WriteRequest {allocation, slot_index: 0};
assert!(request.slot_index >= 0);Trait Implementations§
Auto Trait Implementations§
impl !Sync for WriteRequest
impl Freeze for WriteRequest
impl RefUnwindSafe for WriteRequest
impl Send for WriteRequest
impl Unpin for WriteRequest
impl UnsafeUnpin for WriteRequest
impl UnwindSafe for WriteRequest
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