Skip to content

Conversation

@matthiasbeyer
Copy link

@matthiasbeyer matthiasbeyer commented Sep 28, 2025

Part of #172

Description

As per rust API guidelines 0, only smart pointers should implement Deref.
So, we remove the impl Deref<Blobs> for Store in this patch.

Breaking Changes

The impl Deref<Blobs> for Store was removed. For all calls to Store functions that were referred to the underlying Blobs instance, use Store::blobs() to get a &Blobs.

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

As per rust API guidelines [0], only smart pointers should implement
`Deref`.
So, we remove the `impl Deref<Blobs> for Store` in this patch.

[0]: https://rust-lang.github.io/api-guidelines/predictability.html?highlight=Deref#only-smart-pointers-implement-deref-and-derefmut-c-deref

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
@n0bot n0bot bot added this to iroh Sep 28, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Sep 28, 2025
@rklaehn
Copy link
Collaborator

rklaehn commented Dec 4, 2025

Thanks for the PR. Not quite sure how to best do this, but I think you are right that we are overusing deref.

@matthiasbeyer
Copy link
Author

I think the iroh-blobs devs came from OOP languages before implementing this codebase... (no offense of course) but in rustland we use composition over inheritance.

I'd rather would like to see the whole API revamped than some half-baked "fix" for this, tbh!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

2 participants