pub struct PendingBufferRegistration<B: IoBufMut> { /* private fields */ }Expand description
A Batch::register_buffers push not yet matched to its completion.
buffers is ManuallyDrop and this type’s own Drop is deliberately
empty, mirroring the inventory (PR #20 review response): the registration is
already queued via BuildIoRingRegisterBuffers the instant
Batch::register_buffers returns, before any completion is observed,
so a caller that drops this without ever matching a completion has no
proof the kernel is done deciding whether to retain these addresses.
Freeing them here anyway would risk handing memory the kernel still
references back to the allocator; leaking is the safe failure mode, the
same choice the ring’s inventory (D-73) and RegisteredBuffers both
already make.
Implementations§
Source§impl<B: IoBufMut> PendingBufferRegistration<B>
impl<B: IoBufMut> PendingBufferRegistration<B>
Sourcepub fn user_data(&self) -> usize
pub fn user_data(&self) -> usize
This push’s UserData identity, to match against a popped
Completion.
Sourcepub fn claim_if(
self,
completion: &Completion,
) -> Result<Result<RegisteredBuffers<B>>, Self>
pub fn claim_if( self, completion: &Completion, ) -> Result<Result<RegisteredBuffers<B>>, Self>
Turn this pending registration into usable RegisteredBuffers once
completion names it, or hand it back unchanged if completion
names a different operation.
§Errors
The inner Result is Err if the registration itself failed; the
buffers are dropped normally in that case, exactly as if they had
never been registered – a matched completion, success or failure, is
exactly the proof this type’s Drop is waiting for.