use crate::Pin;
#[doc = crate::_tags!(mem lifetime)]
#[doc = crate::_doc_location!("sys/mem")]
#[rustfmt::skip]
#[derive(Debug)]
pub struct Pinned<A, B = (), C = (), D = (), E = (), F = (), G = (), H = ()> {
a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H
}
#[rustfmt::skip]
mod impls {
use super::{Pin, Pinned};
impl<A> Pinned<A> {
pub fn from_a(a: A) -> Self {
Pinned { a, b: (), c: (), d: (), e: (), f: (), g: (), h: () }
}
pub fn with_b<B>(self, b: B) -> Pinned<A, B> {
Pinned { a: self.a,
b, c: (), d: (), e: (), f: (), g: (), h: ()
}
}
}
impl<A, B> Pinned<A, B> {
pub fn with_c<C>(self, c: C) -> Pinned<A, B, C> {
Pinned {
a: self.a, b: self.b,
c, d: (), e: (), f: (), g: (), h: ()
}
}
}
impl<A, B, C> Pinned<A, B, C> {
pub fn with_d<D>(self, d: D) -> Pinned<A, B, C, D> {
Pinned {
a: self.a, b: self.b, c: self.c,
d, e: (), f: (), g: (), h: (),
}
}
}
impl<A, B, C, D> Pinned<A, B, C, D> {
pub fn with_e<E>(self, e: E) -> Pinned<A, B, C, D, E> {
Pinned {
a: self.a, b: self.b, c: self.c, d: self.d,
e, f: (), g: (), h: ()
}
}
}
impl<A, B, C, D, E> Pinned<A, B, C, D, E> {
pub fn with_f<F>(self, f: F) -> Pinned<A, B, C, D, E, F> {
Pinned {
a: self.a, b: self.b, c: self.c, d: self.d, e: self.e,
f, g: (), h: (),
}
}
}
impl<A, B, C, D, E, F> Pinned<A, B, C, D, E, F> {
pub fn with_g<G>(self, g: G) -> Pinned<A, B, C, D, E, F, G> {
Pinned {
a: self.a, b: self.b, c: self.c, d: self.d, e: self.e, f: self.f,
g, h: (),
}
}
}
impl<A, B, C, D, E, F, G> Pinned<A, B, C, D, E, F, G> {
pub fn with_h<H>(self, h: H) -> Pinned<A, B, C, D, E, F, G, H> {
Pinned {
a: self.a, b: self.b, c: self.c, d: self.d, e: self.e, f: self.f, g: self.g,
h,
}
}
}
impl<A, B, C, D, E, F, G, H> Pinned<A, B, C, D, E, F, G, H> {
pub fn a(self: Pin<&mut Self>) -> Pin<&mut A> {
unsafe { self.map_unchecked_mut(|this| &mut this.a) }
}
pub fn b(self: Pin<&mut Self>) -> Pin<&mut B> {
unsafe { self.map_unchecked_mut(|this| &mut this.b) }
}
pub fn c(self: Pin<&mut Self>) -> Pin<&mut C> {
unsafe { self.map_unchecked_mut(|this| &mut this.c) }
}
pub fn d(self: Pin<&mut Self>) -> Pin<&mut D> {
unsafe { self.map_unchecked_mut(|this| &mut this.d) }
}
pub fn e(self: Pin<&mut Self>) -> Pin<&mut E> {
unsafe { self.map_unchecked_mut(|this| &mut this.e) }
}
pub fn f(self: Pin<&mut Self>) -> Pin<&mut F> {
unsafe { self.map_unchecked_mut(|this| &mut this.f) }
}
pub fn g(self: Pin<&mut Self>) -> Pin<&mut G> {
unsafe { self.map_unchecked_mut(|this| &mut this.g) }
}
pub fn h(self: Pin<&mut Self>) -> Pin<&mut H> {
unsafe { self.map_unchecked_mut(|this| &mut this.h) }
}
}
}