IntoInitPin

Trait IntoInitPin 

Source
pub trait IntoInitPin<T: ?Sized, Marker = ()>: Sized {
    type Init: InitPin<T, Error = Self::Error>;
    type Error;

    // Required method
    fn into_init(self) -> Self::Init;
}
Expand description

A trait for converting a value into a pin-initializer for type T.

This trait is used to allow types to be directly used as initializers without needing to wrap them in a specific initializer factory function.

There does not exist a trait called IntoInitializer, which seems to be a natural extension for the Initializer, InitPin, and Init subtrait chain. This is because Marker and the target type T cannot be separated for correct type inference.

Required Associated Types§

Source

type Init: InitPin<T, Error = Self::Error>

Which kind of initializer this converts into?

Source

type Error

The error type that can occur during initialization.

Required Methods§

Source

fn into_init(self) -> Self::Init

Creates an initializer from this value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, T: Clone> IntoInitPin<[T], Slice<'a, T>> for &'a [T]

Source§

type Init = Slice<'a, T>

Source§

type Error = SliceError

Source§

fn into_init(self) -> Self::Init

Source§

impl<'a, T: Clone, const N: usize> IntoInitPin<[T; N], Slice<'a, T>> for &'a [T]

Source§

type Init = Slice<'a, T>

Source§

type Error = SliceError

Source§

fn into_init(self) -> Self::Init

Source§

impl<'b> IntoInitPin<str, Str<'b>> for &'b str

Implementors§

Source§

impl<T, E, F> IntoInitPin<T, TryWith<F>> for F
where F: FnOnce() -> Result<T, E>,

Source§

impl<T, F> IntoInitPin<T, With<F>> for F
where F: FnOnce() -> T,

Source§

impl<T: Clone> IntoInitPin<T, Value<T>> for T

Source§

impl<T: ?Sized, I: InitPin<T>> IntoInitPin<T> for I