Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Akka.Util: improve Result<T> #7520

Merged
merged 4 commits into from
Mar 13, 2025

Conversation

Aaronontheweb
Copy link
Member

@Aaronontheweb Aaronontheweb commented Mar 13, 2025

Changes

Designed to support our work on #7518

Makes the following changes to Result<T>:

  • Enables nullability
  • Converts fields to properties (should have been that way from the beginning IMHO) - this might be a binary compatibility issue but I doubt it though as this is mostly used internally by Akka.Streams and other components.
  • Redesigns the struct to be a readonly record struct so it an automatically benefit from equality by value and other compiler optimizations

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

Sorry, something went wrong.

@Aaronontheweb Aaronontheweb added this to the 1.5.39 milestone Mar 13, 2025
public static Akka.Util.Result<T> From<T>(System.Func<T> func) { }
public static Akka.Util.Result<T> FromTask<T>(System.Threading.Tasks.Task<T> task) { }
public static Akka.Util.Result<T> Success<T>(T value) { }
[return: System.Runtime.CompilerServices.NullableAttribute(new byte[] {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API change - make fields into nullable properties.

Copy link
Contributor

@Arkatufus Arkatufus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb
Copy link
Member Author

Reverted back to using fields here instead of properties, out of an abundance of caution WRT binary compatibility

@Aaronontheweb Aaronontheweb merged commit 10b8223 into akkadotnet:dev Mar 13, 2025
3 of 11 checks passed
@Aaronontheweb Aaronontheweb deleted the result-nullability branch March 13, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants