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

Scoping #53

Closed
wants to merge 7 commits into from
Closed

Scoping #53

wants to merge 7 commits into from

Conversation

cyypherus
Copy link
Owner

@cyypherus cyypherus commented Oct 13, 2024

This Approach:

  • ✅ Fixes half baked scoping with the single state case
  • ⚠️ Partial scoping is impossible given &mut Ui, &mut ViewStateIWantToScope

Multiple state generics: https://github.com/ejjonny/backer/tree/multistate

  • ✅ Compiles without workarounds
  • ✅ Enables partial scoping given &mut Ui, &mut ViewStateIWantToScope
  • ⚠️ Really doesn't scale, maybe that's fine
  • ⚠️ Noisy API to account for the single generic use case

Trait based scoping: https://github.com/ejjonny/backer/tree/trait-scoping

  • ✅ Eliminates the need for AnyNode & related lifetime trouble
  • ⚠️ Actually conforming to Scopable as a user seems to be complex or error prone due to some recursive conformance checks? I can't even get the partial scoping test to compile..
  • ❌ Requires manual drop as a workaround for this issue
  • ❌ Causes clippy eternal lint issue

Copy link

Commit: 7064480

Removed items from the public API
=================================
(none)

Changed items in the public API
===============================
-pub fn backer::nodes::scope<U: 'static, V: 'static>(scope: fn(&mut U) -> &mut V, node: backer::Node<V>) -> backer::Node<U>
+pub fn backer::nodes::scope<T, U: 'static>(scope: impl core::ops::function::Fn(&mut T) -> &mut U + 'static + core::marker::Copy, node: impl core::ops::function::Fn(&mut U) -> backer::Node<U> + 'static + core::marker::Copy) -> backer::Node<T>

Added items to the public API
=============================
(none)

@cyypherus cyypherus closed this Oct 16, 2024
@cyypherus cyypherus deleted the scoping branch October 16, 2024 05:10
@cyypherus
Copy link
Owner Author

Closed in favor of #55

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.

1 participant