Sp

Struct Sp 

Source
pub struct Sp<A, B = (), C = (), D = (), E = (), F = (), G = (), H = ()> { /* private fields */ }
Expand description

Sp stands for Structurally Pinned

Up to 8 generics can be supplied for 8 structurally pinned fields.

Implementations§

Source§

impl<A> Sp<A>

Source

pub fn from_a(a: A) -> Self

Create a new Sp with a single field

Examples found in repository?
examples/noalloc.rs (line 21)
19        pub fn build(self) -> StructurallyPinnedStruct {
20            let Self { a, b, c } = self;
21            Sp::from_a(a).with_b(b).with_c(c).with_d(Seal)
22        }
More examples
Hide additional examples
examples/simple.rs (line 12)
11        pub fn new(a: u32, b: String, c: Option<&'static [u8]>) -> Self {
12            let inner = Sp::from_a(a).with_b(b).with_c(c);
13            Self(Box::pin(inner))
14        }
Source

pub fn with_b<B>(self, b: B) -> Sp<A, B>

Add field B to an Sp

Examples found in repository?
examples/noalloc.rs (line 21)
19        pub fn build(self) -> StructurallyPinnedStruct {
20            let Self { a, b, c } = self;
21            Sp::from_a(a).with_b(b).with_c(c).with_d(Seal)
22        }
More examples
Hide additional examples
examples/simple.rs (line 12)
11        pub fn new(a: u32, b: String, c: Option<&'static [u8]>) -> Self {
12            let inner = Sp::from_a(a).with_b(b).with_c(c);
13            Self(Box::pin(inner))
14        }
Source§

impl<A, B> Sp<A, B>

Source

pub fn with_c<C>(self, c: C) -> Sp<A, B, C>

Add field C to an Sp

Examples found in repository?
examples/noalloc.rs (line 21)
19        pub fn build(self) -> StructurallyPinnedStruct {
20            let Self { a, b, c } = self;
21            Sp::from_a(a).with_b(b).with_c(c).with_d(Seal)
22        }
More examples
Hide additional examples
examples/simple.rs (line 12)
11        pub fn new(a: u32, b: String, c: Option<&'static [u8]>) -> Self {
12            let inner = Sp::from_a(a).with_b(b).with_c(c);
13            Self(Box::pin(inner))
14        }
Source§

impl<A, B, C> Sp<A, B, C>

Source

pub fn with_d<D>(self, d: D) -> Sp<A, B, C, D>

Add field D to an Sp

Examples found in repository?
examples/noalloc.rs (line 21)
19        pub fn build(self) -> StructurallyPinnedStruct {
20            let Self { a, b, c } = self;
21            Sp::from_a(a).with_b(b).with_c(c).with_d(Seal)
22        }
Source§

impl<A, B, C, D> Sp<A, B, C, D>

Source

pub fn with_e<E>(self, e: E) -> Sp<A, B, C, D, E>

Add field E to an Sp

Source§

impl<A, B, C, D, E> Sp<A, B, C, D, E>

Source

pub fn with_f<F>(self, f: F) -> Sp<A, B, C, D, E, F>

Add field F to an Sp

Source§

impl<A, B, C, D, E, F> Sp<A, B, C, D, E, F>

Source

pub fn with_g<G>(self, g: G) -> Sp<A, B, C, D, E, F, G>

Add field G to an Sp

Source§

impl<A, B, C, D, E, F, G> Sp<A, B, C, D, E, F, G>

Source

pub fn with_h<H>(self, h: H) -> Sp<A, B, C, D, E, F, G, H>

Add field H to an Sp

Source§

impl<A, B, C, D, E, F, G, H> Sp<A, B, C, D, E, F, G, H>

Source

pub fn a(self: Pin<&mut Self>) -> Pin<&mut A>

Get a Pin<&mut A>

Examples found in repository?
examples/simple.rs (line 17)
16        pub fn use_pinned_types(&mut self) {
17            let _a: Pin<&mut u32> = self.0.as_mut().a();
18            let _b: Pin<&mut String> = self.0.as_mut().b();
19            let _c: Pin<&mut Option<&'static [u8]>> = self.0.as_mut().c();
20        }
More examples
Hide additional examples
examples/noalloc.rs (line 31)
30        fn use_pinned_types(mut self: Pin<&mut Self>) {
31            let _a: Pin<&mut u32> = self.as_mut().a();
32            let _b: Pin<&mut String> = self.as_mut().b();
33            let _c: Pin<&mut Option<&'static [u8]>> = self.as_mut().c();
34        }
Source

pub fn b(self: Pin<&mut Self>) -> Pin<&mut B>

Get a Pin<&mut B>

Examples found in repository?
examples/simple.rs (line 18)
16        pub fn use_pinned_types(&mut self) {
17            let _a: Pin<&mut u32> = self.0.as_mut().a();
18            let _b: Pin<&mut String> = self.0.as_mut().b();
19            let _c: Pin<&mut Option<&'static [u8]>> = self.0.as_mut().c();
20        }
More examples
Hide additional examples
examples/noalloc.rs (line 32)
30        fn use_pinned_types(mut self: Pin<&mut Self>) {
31            let _a: Pin<&mut u32> = self.as_mut().a();
32            let _b: Pin<&mut String> = self.as_mut().b();
33            let _c: Pin<&mut Option<&'static [u8]>> = self.as_mut().c();
34        }
Source

pub fn c(self: Pin<&mut Self>) -> Pin<&mut C>

Get a Pin<&mut C>

Examples found in repository?
examples/simple.rs (line 19)
16        pub fn use_pinned_types(&mut self) {
17            let _a: Pin<&mut u32> = self.0.as_mut().a();
18            let _b: Pin<&mut String> = self.0.as_mut().b();
19            let _c: Pin<&mut Option<&'static [u8]>> = self.0.as_mut().c();
20        }
More examples
Hide additional examples
examples/noalloc.rs (line 33)
30        fn use_pinned_types(mut self: Pin<&mut Self>) {
31            let _a: Pin<&mut u32> = self.as_mut().a();
32            let _b: Pin<&mut String> = self.as_mut().b();
33            let _c: Pin<&mut Option<&'static [u8]>> = self.as_mut().c();
34        }
Source

pub fn d(self: Pin<&mut Self>) -> Pin<&mut D>

Get a Pin<&mut D>

Source

pub fn e(self: Pin<&mut Self>) -> Pin<&mut E>

Get a Pin<&mut E>

Source

pub fn f(self: Pin<&mut Self>) -> Pin<&mut F>

Get a Pin<&mut F>

Source

pub fn g(self: Pin<&mut Self>) -> Pin<&mut G>

Get a Pin<&mut G>

Source

pub fn h(self: Pin<&mut Self>) -> Pin<&mut H>

Get a Pin<&mut H>

Auto Trait Implementations§

§

impl<A, B, C, D, E, F, G, H> Freeze for Sp<A, B, C, D, E, F, G, H>
where A: Freeze, B: Freeze, C: Freeze, D: Freeze, E: Freeze, F: Freeze, G: Freeze, H: Freeze,

§

impl<A, B, C, D, E, F, G, H> RefUnwindSafe for Sp<A, B, C, D, E, F, G, H>

§

impl<A, B, C, D, E, F, G, H> Send for Sp<A, B, C, D, E, F, G, H>
where A: Send, B: Send, C: Send, D: Send, E: Send, F: Send, G: Send, H: Send,

§

impl<A, B, C, D, E, F, G, H> Sync for Sp<A, B, C, D, E, F, G, H>
where A: Sync, B: Sync, C: Sync, D: Sync, E: Sync, F: Sync, G: Sync, H: Sync,

§

impl<A, B, C, D, E, F, G, H> Unpin for Sp<A, B, C, D, E, F, G, H>
where A: Unpin, B: Unpin, C: Unpin, D: Unpin, E: Unpin, F: Unpin, G: Unpin, H: Unpin,

§

impl<A, B, C, D, E, F, G, H> UnwindSafe for Sp<A, B, C, D, E, F, G, H>

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.