FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    BindInteractionMixins

    trait · ferroui-reactiveui · v0.5.0

    trait BindInteractionMixins<V: 'static>
    

    BindInteraction: registers a handler of a view on the interaction a property of its view model holds, and moves it to the new interaction when the property changes. Implemented for every Rc of a view.

    Upstream's source generator roots the property at the view's ViewModel when the view declares one: the handler follows the view model the view displays, a new view model included, and a view without a view model has nothing registered. bind_interaction and bind_interaction_observable do that for a view that declares its view model (IViewForOf<VM>), observed as the property ViewModel of the view (a view that does not notify its changes is read once); bind_interaction_on and bind_interaction_observable_on root the property at a given view model, as for a view that does not declare one.

    Deviation (DEVIATIONS.md, ReactiveUI): upstream overloads BindInteraction by the kind of handler (a Task or an observable) and resolves the root at compile time; here each is a method of its own. The view-rooted forms leave out upstream's viewModel argument, which the generated code does not read either. The expression is a PropertyPath.

    View source

    Members

    bind_interaction

    fn bind_interaction<VM, X, Fut>(self: &Self, path: PropertyPath<Rc<VM>, X>, handler: impl Fn(InteractionContextOf<X>) -> Fut + 'static) -> Rc<dyn IDisposable>
    where V: IViewForOf<VM>,
          VM: 'static,
          X: InteractionValue,
          Fut: Future<Output = Result<(), ObservableError>> + 'static
    

    Registers the asynchronous handler on the interaction path reads from the view's view model (BindInteraction(..., Func<IInteractionContext<TInput, TOutput>, Task>)). The handler gives a future of a Result<(), ObservableError>, which ends when it has handled the question.

    Source

    bind_interaction_observable

    fn bind_interaction_observable<VM, X, D>(self: &Self, path: PropertyPath<Rc<VM>, X>, handler: impl Fn(InteractionContextOf<X>) -> Rc<dyn IObservable<D>> + 'static) -> Rc<dyn IDisposable>
    where V: IViewForOf<VM>,
          VM: 'static,
          X: InteractionValue,
          D: 'static
    

    Registers the observable-based handler on the interaction path reads from the view's view model; the handler has finished when its observable ends (BindInteraction(..., Func<IInteractionContext<TInput, TOutput>, IObservable<TDontCare>>)).

    Source

    bind_interaction_on

    fn bind_interaction_on<VM, X, Fut>(self: &Self, view_model: Option<Rc<VM>>, path: PropertyPath<Rc<VM>, X>, handler: impl Fn(InteractionContextOf<X>) -> Fut + 'static) -> Rc<dyn IDisposable>
    where VM: 'static,
          X: InteractionValue,
          Fut: Future<Output = Result<(), ObservableError>> + 'static
    

    bind_interaction rooted at view_model; no view model registers nothing.

    Source

    bind_interaction_observable_on

    fn bind_interaction_observable_on<VM, X, D>(self: &Self, view_model: Option<Rc<VM>>, path: PropertyPath<Rc<VM>, X>, handler: impl Fn(InteractionContextOf<X>) -> Rc<dyn IObservable<D>> + 'static) -> Rc<dyn IDisposable>
    where VM: 'static,
          X: InteractionValue,
          D: 'static
    

    bind_interaction_observable rooted at view_model; no view model registers nothing.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.