Trait uninit_tools::traits::Equivalent [−][src]
pub unsafe trait Equivalent<T> where
T: Initialize,
Self: Initialize<Item = <T as Initialize>::Item>, { }
A marker trait which indicates that two different implementations of Initialize
have the
same memory layout, and behave equivalently with respect to their implementations of
Initialize
and AssertInit
.
A usecase for this, is e.g. if you need InitializeVectored
<Item = IoSliceMut>
for system
call ABI reasons, but you have a different type which still has the same layout, e.g.
SingleVector
<
AsUninit
<IoSliceMut>>
.
In general, it also allows changing the inner T, while still tracking the initializedness
properly. For single-buffer I/O, this allows converting between any Equivalent
types, where
for vectored I/O, it allows a more restricted type of conversion, where they also need to be
slice-castable.