Skip to main content

WindowsBackend

Struct WindowsBackend 

Source
pub struct WindowsBackend<B: IoBuf, R: IoBufMut = Vec<u8>> { /* private fields */ }
Expand description

The Windows backend: an IoRing and the targets it runs I/O for. B is the owned buffer type and R the registered buffers’.

Write-only buffer types (DI-D-17): an owned write needs only B: IoBuf, so a type such as Arc<[u8]> can be written. An owned read needs B: IoBufMut, and is pushed through a push made where that bound holds: new makes it, without_owned_reads does not, and an owned read on a backend without it is refused as RefusalCause::Unsupported.

Implementations§

Source§

impl<B: IoBufMut, R: IoBufMut> WindowsBackend<B, R>

Source

pub fn new( setup: WindowsBackendSetup<R>, ) -> Result<Self, WindowsBackendError<R>>

A ring with setup’s queue sizes, its targets and buffers registered, and its completion event attached, which reads into owned buffers as well as writing from them.

§Errors

WindowsBackendError, handing back the targets and, where it can, the buffers.

Source§

impl<B: IoBuf, R: IoBufMut> WindowsBackend<B, R>

Source

pub fn without_owned_reads( setup: WindowsBackendSetup<R>, ) -> Result<Self, WindowsBackendError<R>>

As new, for a buffer type that may be only IoBuf: it writes from owned buffers and reads into registered ones, and refuses an owned read as RefusalCause::Unsupported (DI-D-17).

§Errors

WindowsBackendError, handing back the targets and, where it can, the buffers.

Source

pub fn target(&self, key: IoTargetKey) -> Option<&Win32FileTarget>

The target under key, if there is one.

Source

pub fn registered_buffer(&mut self, index: u32) -> Result<&[u8]>

Registered buffer index’s bytes.

§Errors

For a backend built without registered buffers, or an index out of range.

Source

pub fn registered_buffer_mut(&mut self, index: u32) -> Result<&mut [u8]>

Registered buffer index’s bytes, writable.

§Errors

As registered_buffer.

Trait Implementations§

Source§

impl<B: IoBuf, R: IoBufMut> IoBackend for WindowsBackend<B, R>

Source§

type Target = Win32FileTarget

What it runs I/O for.
Source§

type Buffer = B

The owned buffers its submissions carry.
Source§

type Notification = CompletionEvent

What it raises when its completions go from none to some.
Source§

fn attach( &mut self, key: IoTargetKey, target: Win32FileTarget, ) -> Result<(), DuplicateTarget<Win32FileTarget>>

Run I/O for target under key. Read more
Source§

fn detach(&mut self, key: IoTargetKey) -> Option<Win32FileTarget>

Stop running I/O for the target under key, handing it back; None if there is none. A submission for it queued but not yet submitted still completes exactly once, through pop: with a fault, or, for a backend that cannot take a queued submission back, issued as it would have been, to the file it was pushed for. The core detaches a target only with no operation outstanding, so a driver does not meet either.
Source§

fn registered_buffers(&self) -> u32

How many registered buffers it has; a RegisteredRegion names one by its position.
Source§

fn check( &self, target: IoTargetKey, op: &SubmissionOp<B>, ) -> Result<(), RefusalCause>

Whether push would refuse op on target for a cause that does not depend on its queues: no target under the key, an operation it cannot perform, or one malformed for its target. The core asks before it holds an operation for its gate, so a gated operation is refused at the consumer’s push for what an ungated one would be (DI-D-54). A push this accepts may still be refused for a full queue, or by a backend that has become unusable. Read more
Source§

fn push(&mut self, submission: Submission<B>) -> Result<(), Refused<B>>

Queue submission, to be issued no later than the next submit. It is the backend’s from here until it completes: only a refusal hands it back. Read more
Source§

fn submit(&mut self) -> Result<(), RefusalCause>

Issue every queued submission. Read more
Source§

fn pop(&mut self) -> Result<Option<Completion<B>>, IoFault>

Take the oldest completion, if there is one. Read more
Source§

fn notification(&self) -> Result<CompletionEvent, IoFault>

A handle on its notification. Read more

Auto Trait Implementations§

§

impl<B, R = Vec<u8>> !Sync for WindowsBackend<B, R>

§

impl<B, R> Freeze for WindowsBackend<B, R>
where IoRing<B, Sidecar, Owned>: Freeze, Option<RegisteredBuffers<R>>: Freeze, Option<for<'r, 'v> fn(&mut Batch<'r, B, Sidecar, Owned>, Via<'v>, B, Sidecar, u64) -> Result<OperationId, PushRefused<B, Sidecar>>>: Freeze,

§

impl<B, R> RefUnwindSafe for WindowsBackend<B, R>
where IoRing<B, Sidecar, Owned>: RefUnwindSafe, Option<RegisteredBuffers<R>>: RefUnwindSafe, Option<for<'r, 'v> fn(&mut Batch<'r, B, Sidecar, Owned>, Via<'v>, B, Sidecar, u64) -> Result<OperationId, PushRefused<B, Sidecar>>>: RefUnwindSafe,

§

impl<B, R> Send for WindowsBackend<B, R>
where IoRing<B, Sidecar, Owned>: Send, Option<RegisteredBuffers<R>>: Send, Option<for<'r, 'v> fn(&mut Batch<'r, B, Sidecar, Owned>, Via<'v>, B, Sidecar, u64) -> Result<OperationId, PushRefused<B, Sidecar>>>: Send,

§

impl<B, R> Unpin for WindowsBackend<B, R>
where IoRing<B, Sidecar, Owned>: Unpin, Option<RegisteredBuffers<R>>: Unpin, Option<for<'r, 'v> fn(&mut Batch<'r, B, Sidecar, Owned>, Via<'v>, B, Sidecar, u64) -> Result<OperationId, PushRefused<B, Sidecar>>>: Unpin,

§

impl<B, R> UnsafeUnpin for WindowsBackend<B, R>
where IoRing<B, Sidecar, Owned>: UnsafeUnpin, Option<RegisteredBuffers<R>>: UnsafeUnpin, Option<for<'r, 'v> fn(&mut Batch<'r, B, Sidecar, Owned>, Via<'v>, B, Sidecar, u64) -> Result<OperationId, PushRefused<B, Sidecar>>>: UnsafeUnpin,

§

impl<B, R> UnwindSafe for WindowsBackend<B, R>
where IoRing<B, Sidecar, Owned>: UnwindSafe, Option<RegisteredBuffers<R>>: UnwindSafe, Option<for<'r, 'v> fn(&mut Batch<'r, B, Sidecar, Owned>, Via<'v>, B, Sidecar, u64) -> Result<OperationId, PushRefused<B, Sidecar>>>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.