Fix the generator example for pin!()
This commit is contained in:
parent
4c60a0ea5b
commit
6d523e9a75
@ -1006,9 +1006,10 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
|
|||||||
/// // Allow generator to be self-referential (not `Unpin`)
|
/// // Allow generator to be self-referential (not `Unpin`)
|
||||||
/// // vvvvvv so that locals can cross yield points.
|
/// // vvvvvv so that locals can cross yield points.
|
||||||
/// static || {
|
/// static || {
|
||||||
/// let foo = String::from("foo"); // --+
|
/// let foo = String::from("foo");
|
||||||
/// yield 0; // | <- crosses yield point!
|
/// let foo_ref = &foo; // ------+
|
||||||
/// println!("{}", &foo); // <----------+
|
/// yield 0; // | <- crosses yield point!
|
||||||
|
/// println!("{foo_ref}"); // <--+
|
||||||
/// yield foo.len();
|
/// yield foo.len();
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
|
Loading…
Reference in New Issue
Block a user