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

Refactor crate to be more composable and simple #28

Open
Kimundi opened this issue Mar 5, 2017 · 1 comment
Open

Refactor crate to be more composable and simple #28

Kimundi opened this issue Mar 5, 2017 · 1 comment

Comments

@Kimundi
Copy link
Owner

Kimundi commented Mar 5, 2017

Right now the crate contains a bunch of types and typedefs for different mutabilty and usecase scenarios.

It would be nice if the API could be simplified by offloading some of the duplication and different behaviors to type paramers instead.

Possible refactors:

  • Anything using the Erased trait should be made generic over the actual trait, to support varitions like Erased+Send or Erased+Sync
    • This especially includes the *Ref type defs
  • OwningRef and OwningRefMut are potentially mergeable by adding a type parameter for the mutabilty: OwningRef<*const T> and OwningRef<*mut T>. Or with specially defined marker types: OwningRef<Shared> and OwningRef<Mutable>.
  • OwningRef might possibly be implemented in terms of an OwningHandle.
@Storyyeller
Copy link
Contributor

I don't think it's useful to try to merge OwningRef and OwningRefMut, since Rust doesn't provide any good way to abstract over mutability. Even if you try, you'll run into the issue that methods have to change receiver type (&self vs &mut self)

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

No branches or pull requests

2 participants