1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! `boxpin` adds a `.pinned()` suffix for values that should become
//! [`Pin<Box<T>>`](std::pin::Pin).
//!
//! The method is intentionally tiny and does exactly what it looks like:
//! it forwards to [`Box::pin`].
//!
//! # Examples
//!
//! Pin an async block with suffix syntax:
//!
//! ```
//! use boxpin::BoxPinExt;
//!
//! # futures::executor::block_on(async {
//! let value = async { 41_u8 }.pinned().await;
//! assert_eq!(value, 41);
//! # });
//! ```
//!
//! Pin a regular value:
//!
//! ```
//! use boxpin::BoxPinExt;
//!
//! let pinned = String::from("boxpin").pinned();
//! assert_eq!(&*pinned, "boxpin");
//! ```
use Pin;
/// Extension trait that exposes [`Box::pin`] as the `.pinned()` suffix.