Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I propose the implementation of
into_
helpers forValue
. I opted for some design choices, which can reconsider without problem:Result
s, and theErr
type isSelf
. In this way thevalue
is not lost if the conversion fails. Maybe it is a bit less ergonomic than returningOption
, but it should be slightly more powerful.Self
inErr
, butValue
inOk
for nested things likeArray
andMap
. This is only to avoid types likeReturn<Vec<Self>, Self>
, which can be slightly confusing.into_
methods forCopy
types as well. I made it for consistency, but to be honest I am a bit unsure.into_null
, which would have the following signature:Let me know what do you think, I will be happy to receive feedback, discuss and change things in order to expose a nice API.