Struct same_alloc::same::SameLayout [−][src]
A proof type, showing two types A
and B
have the same layout.
Implementations
impl<A, B> SameLayout<A, B>
[src]
pub const fn new() -> Option<Self>
[src]
pub fn forget_vec(self, vec: Vec<A>) -> Vec<B>
[src]
‘Transmute’ a vector by reusing its buffer.
NOTE: This will forget all elements. You must clear the vector first if they are
important, or set_len
on the result if you can guarantee that old elements are valid
initializers for the new type.
This affords more flexibility for the caller as they might want to use As as an initializer
for Bs which would be invalid if we dropped them. Manually drain the vector if this is not
desirable.
pub fn deinit_box(self, boxed: Box<A>) -> (A, Box<MaybeUninit<B>>)
[src]
‘Transmute’ a box by reusing its buffer.
NOTE: for the same flexibility as Vec, forget about the returned A
.
impl<A, B> SameLayout<A, B>
[src]
pub const fn array<const N: usize>(self) -> SameLayout<[A; N], [B; N]>
[src]
pub const fn chain<C>(self, _: SameLayout<B, C>) -> SameLayout<A, C>
[src]
Apply a transitive argument to construct a new relation proof.
pub const fn transpose(self) -> SameLayout<B, A>
[src]
Use commutativity of equality.
Trait Implementations
impl<A, B> Clone for SameLayout<A, B>
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<A, B> Copy for SameLayout<A, B>
[src]
impl<A: Debug, B: Debug> Debug for SameLayout<A, B>
[src]
impl<A: Eq, B: Eq> Eq for SameLayout<A, B>
[src]
impl<A: Hash, B: Hash> Hash for SameLayout<A, B>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<A: PartialEq, B: PartialEq> PartialEq<SameLayout<A, B>> for SameLayout<A, B>
[src]
fn eq(&self, other: &SameLayout<A, B>) -> bool
[src]
fn ne(&self, other: &SameLayout<A, B>) -> bool
[src]
impl<A, B> StructuralEq for SameLayout<A, B>
[src]
impl<A, B> StructuralPartialEq for SameLayout<A, B>
[src]
Auto Trait Implementations
impl<A, B> Send for SameLayout<A, B> where
A: Send,
B: Send,
A: Send,
B: Send,
impl<A, B> Sync for SameLayout<A, B> where
A: Sync,
B: Sync,
A: Sync,
B: Sync,
impl<A, B> Unpin for SameLayout<A, B> where
A: Unpin,
B: Unpin,
A: Unpin,
B: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,