Re: [PATCH v3 12/13] rust: init: add `{pin_}chain` functions to `{Pin}Init<T, E>`

From: Martin Rodriguez Reboredo
Date: Sat Aug 05 2023 - 13:16:57 EST


On 7/29/23 06:10, Benno Lossin wrote:
The `{pin_}chain` functions extend an initializer: it not only
initializes the value, but also executes a closure taking a reference to
the initialized value. This allows to do something with a value directly
after initialization.

Suggested-by: Asahi Lina <lina@xxxxxxxxxxxxx>
Signed-off-by: Benno Lossin <benno.lossin@xxxxxxxxx>
---
[...]
+ /// First initializes the value using `self` then calls the function `f` with the initialized
+ /// value.
+ ///
+ /// If `f` returns an error the value is dropped and the initializer will forward the error.

It's way more clear now... Thanks!

[...]
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@xxxxxxxxx>