Operation

Trait Operation 

Source
pub trait Operation<T = ()>: Send {
    // Required method
    fn traverse(&mut self, operate: &mut dyn FnMut(&mut dyn Operation<T>));

    // Provided methods
    fn container(&mut self, _id: Option<&Id>, _bounds: Rectangle) { ... }
    fn scrollable(
        &mut self,
        _id: Option<&Id>,
        _bounds: Rectangle,
        _content_bounds: Rectangle,
        _translation: Vector,
        _state: &mut dyn Scrollable,
    ) { ... }
    fn focusable(
        &mut self,
        _id: Option<&Id>,
        _bounds: Rectangle,
        _state: &mut dyn Focusable,
    ) { ... }
    fn text_input(
        &mut self,
        _id: Option<&Id>,
        _bounds: Rectangle,
        _state: &mut dyn TextInput,
    ) { ... }
    fn text(&mut self, _id: Option<&Id>, _bounds: Rectangle, _text: &str) { ... }
    fn custom(
        &mut self,
        _id: Option<&Id>,
        _bounds: Rectangle,
        _state: &mut dyn Any,
    ) { ... }
    fn finish(&self) -> Outcome<T> { ... }
}
Expand description

A piece of logic that can traverse the widget tree of an application in order to query or update some widget state.

Required Methods§

Source

fn traverse(&mut self, operate: &mut dyn FnMut(&mut dyn Operation<T>))

Requests further traversal of the widget tree to keep operating.

The provided operate closure may be called by an Operation to return control to the widget tree and keep traversing it. If the closure is not called, the children of the widget asking for traversal will be skipped.

Provided Methods§

Source

fn container(&mut self, _id: Option<&Id>, _bounds: Rectangle)

Operates on a widget that contains other widgets.

Source

fn scrollable( &mut self, _id: Option<&Id>, _bounds: Rectangle, _content_bounds: Rectangle, _translation: Vector, _state: &mut dyn Scrollable, )

Operates on a widget that can be scrolled.

Source

fn focusable( &mut self, _id: Option<&Id>, _bounds: Rectangle, _state: &mut dyn Focusable, )

Operates on a widget that can be focused.

Source

fn text_input( &mut self, _id: Option<&Id>, _bounds: Rectangle, _state: &mut dyn TextInput, )

Operates on a widget that has text input.

Source

fn text(&mut self, _id: Option<&Id>, _bounds: Rectangle, _text: &str)

Operates on a widget that contains some text.

Source

fn custom(&mut self, _id: Option<&Id>, _bounds: Rectangle, _state: &mut dyn Any)

Operates on a custom widget with some state.

Source

fn finish(&self) -> Outcome<T>

Finishes the Operation and returns its Outcome.

Implementations on Foreign Types§

Source§

impl<T, O> Operation<O> for Box<T>
where T: Operation<O> + ?Sized,

Source§

fn traverse(&mut self, operate: &mut dyn FnMut(&mut dyn Operation<O>))

Source§

fn container(&mut self, id: Option<&Id>, bounds: Rectangle)

Source§

fn focusable( &mut self, id: Option<&Id>, bounds: Rectangle, state: &mut dyn Focusable, )

Source§

fn scrollable( &mut self, id: Option<&Id>, bounds: Rectangle, content_bounds: Rectangle, translation: Vector, state: &mut dyn Scrollable, )

Source§

fn text_input( &mut self, id: Option<&Id>, bounds: Rectangle, state: &mut dyn TextInput, )

Source§

fn text(&mut self, id: Option<&Id>, bounds: Rectangle, text: &str)

Source§

fn custom(&mut self, id: Option<&Id>, bounds: Rectangle, state: &mut dyn Any)

Source§

fn finish(&self) -> Outcome<O>

Implementors§