dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Common reactive interface

Open ealmloff opened this issue 2 years ago • 0 comments

Specific Demand

It would be nice to provide a common way to read different reactive signal-like values. The common interface should support Signals, Fermi atoms, reactive collections (a signal that acts like Signal<Vec<Signal<T>>>>) and mapped signals

Implement Suggestion

  1. We signal something like Box<dyn Readable + Writable> and ReadOnlySignal something like Box<dyn Readable> a) This introduces extra overhead by boxing everything b) You can easily implement IntoSignal<T> for different values like T, and `
  2. We could expose the traits Readable and Writable and let components take impl Readable + Writable or impl Readable a) It should be lower overhead than boxing everything b) You could try to use specialization to implement Readable for T and specialize it on Signal, MappedSignals, and Fermi atoms c) This could introduce a lot of generics which could be an ergonomic issue depending on how well impl trait is supported within components

ealmloff avatar Jan 10 '24 15:01 ealmloff