Lines Matching defs:pin_init
49 //! - directly creating an in-place constructor using the [`pin_init!`] macro,
64 //! ## Using the [`pin_init!`] macro
69 //! [`pin_init!`]. The syntax is almost the same as normal `struct` initializers. The difference is
77 //! use pin_init::{pin_data, pin_init, InPlaceInit};
86 //! let foo = pin_init!(Foo {
90 //! # let _ = Box::pin_init(foo);
101 //! # use pin_init::*;
110 //! # let foo = pin_init!(Foo {
114 //! let foo: Result<Pin<Box<Foo>>, AllocError> = Box::pin_init(foo);
117 //! For more information see the [`pin_init!`] macro.
127 //! # use pin_init::*;
130 //! let mtx: Result<Pin<Arc<CMutex<usize>>>, _> = Arc::pin_init(CMutex::new(42));
137 //! # use pin_init::*;
151 //! buffer: Box::init(pin_init::init_zeroed())?,
173 //! use pin_init::{pin_data, pinned_drop, PinInit, PinnedDrop, pin_init_from_closure};
310 /// This macro enables the use of the [`pin_init!`] macro. When pin-initializing a `struct`,
322 /// use pin_init::pin_data;
341 /// use pin_init::{pin_data, pinned_drop, PinnedDrop};
375 /// use pin_init::{pin_data, pinned_drop, PinnedDrop};
406 /// use pin_init::Zeroable;
417 /// use pin_init::Zeroable;
436 /// use pin_init::MaybeZeroable;
466 /// # use pin_init::*;
480 /// stack_pin_init!(let foo = pin_init!(Foo {
519 /// # use pin_init::*;
546 /// # use pin_init::*;
595 /// # use pin_init::*;
611 /// let initializer = pin_init!(Foo {
618 /// # Box::pin_init(demo()).unwrap();
639 /// # use pin_init::*;
652 /// pin_init!(Self {
666 /// # use pin_init::*;
679 /// # pin_init!(Self {
687 /// let foo = Box::pin_init(Foo::new());
693 /// # use pin_init::*;
706 /// # pin_init!(Self {
725 /// pin_init!(Self {
734 /// Here we see that when using `pin_init!` with `PinInit`, one needs to write `<-` instead of `:`.
740 /// As already mentioned in the examples above, inside of `pin_init!` a `struct` initializer with
754 /// # use pin_init::*;
766 /// let init = pin_init!(&this in Buf {
772 /// let init = pin_init!(Buf {
782 macro_rules! pin_init {
794 /// If the initialization can complete without error (or [`Infallible`]), then use [`pin_init!`].
802 /// The syntax is identical to [`pin_init!`] with the following exception: you must append `? $type`
810 /// use pin_init::{pin_data, try_pin_init, PinInit, InPlaceInit, init_zeroed};
828 /// # let _ = Box::pin_init(BigBuf::new());
855 /// The syntax is identical to [`pin_init!`] and its safety caveats also apply:
862 /// pin-initialize, use [`pin_init!`].
870 /// # use pin_init::InPlaceInit;
871 /// use pin_init::{init, Init, init_zeroed};
917 /// # use pin_init::InPlaceInit;
918 /// use pin_init::{try_init, Init, init_zeroed};
962 /// use pin_init::{pin_data, assert_pinned};
975 /// use pin_init::{pin_data, assert_pinned};
990 /// use pin_init::{pin_data, assert_pinned};
1078 /// # use pin_init::*;
1175 /// use pin_init::{init, init_zeroed, Init};
1319 /// # use pin_init::*;
1320 /// use pin_init::init_array_from_fn;
1359 /// # use pin_init::*;
1361 /// use pin_init::pin_init_array_from_fn;
1364 /// Arc::pin_init(pin_init_array_from_fn(|i| CMutex::new(i))).unwrap();
1459 /// # use pin_init::*;
1520 /// use pin_init::{Zeroable, zeroed};
1584 /// use pin_init::{Zeroable, zeroed};
1692 /// # use pin_init::{pin_data, pin_init, Wrapper};
1703 /// let foo_initializer = pin_init!(Foo{});
1704 /// let initializer = pin_init!(Bar {
1705 /// content <- UnsafeCell::pin_init(foo_initializer)
1710 fn pin_init<E>(value_init: impl PinInit<T, E>) -> impl PinInit<Self, E>;
1714 fn pin_init<E>(value_init: impl PinInit<T, E>) -> impl PinInit<Self, E> {
1721 fn pin_init<E>(value_init: impl PinInit<T, E>) -> impl PinInit<Self, E> {
1729 fn pin_init<E>(init: impl PinInit<T, E>) -> impl PinInit<Self, E> {