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

Refresh: Update Result<T, B> to be Result<(T,B), Error<B> #295

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

ollie-etl
Copy link
Collaborator

@ollie-etl ollie-etl commented Feb 13, 2024

This PR is a update of #267, which seems to have gone stale, due to inactivity on in this repo.

Changes the return type to be a Result of tuples, instead of a tuple containing a result and a buffer. This allows this crate to work in a more ergenomic fashion with ? operator

In addition to updating the original PR, the following changes are made in this one, not in the original

  • BufError renamed Error. This follows the more usual convention of using crate prefixes to qualify error types, rather than the type name itself.
  • BufResult renamed Result. This is the same rational
  • map_buf helper function implrmented with a sealed trait, to give method calling convention, rather than qualified calls

closes #178

@ollie-etl
Copy link
Collaborator Author

@ileixe would you care to review?
@Noah-Kennedy / @carllerche / other maintainer? Any opinions?

src/lib.rs Outdated Show resolved Hide resolved
Copy link

@ileixe ileixe left a comment

Choose a reason for hiding this comment

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

Thanks for pushing this forward. We're waiting for a while this :)

I usually prefer qualifying Error and Result, but on the other hand I thought Buf prefix worth its own as it's a bit different from plain Result. (We're using BufResult and Result in the same place). Let me leave it to someone else.

src/io/read.rs Outdated Show resolved Hide resolved
@ollie-etl
Copy link
Collaborator Author

@ileixe Does this address your comment?

@ileixe
Copy link

ileixe commented Feb 15, 2024

@ollie-etl Exactly, thanks! Ah I did not aware it's not callable outside crate. Can you provide such traits callable (via sealed supertrait)? I think it's common to call it from compatibility layer (to abstract read via uring / non-uring). We ourselves are using it outside the crate.

@ollie-etl
Copy link
Collaborator Author

@ileixe That makes sense - done

src/io/read_fixed.rs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redesign BufResult to be std::result::Result
2 participants