tokio-uring icon indicating copy to clipboard operation
tokio-uring copied to clipboard

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

Open ollie-etl opened this issue 1 year ago • 4 comments

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 avatar Feb 13 '24 12:02 ollie-etl

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

ollie-etl avatar Feb 13 '24 12:02 ollie-etl

@ileixe Does this address your comment?

ollie-etl avatar Feb 14 '24 12:02 ollie-etl

@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.

ileixe avatar Feb 15 '24 00:02 ileixe

@ileixe That makes sense - done

ollie-etl avatar Feb 15 '24 08:02 ollie-etl