iced-yoda/native/src/widget/operation.rs

30 lines
597 B
Rust
Raw Normal View History

pub mod focusable;
pub mod scrollable;
pub use focusable::Focusable;
pub use scrollable::Scrollable;
2022-07-28 02:46:51 +02:00
use crate::widget::Id;
pub trait Operation<T> {
fn container(
&mut self,
id: Option<&Id>,
operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>),
2022-07-28 02:46:51 +02:00
);
fn focusable(&mut self, _state: &mut dyn Focusable, _id: Option<&Id>) {}
fn scrollable(&mut self, _state: &mut dyn Scrollable, _id: Option<&Id>) {}
2022-07-28 02:46:51 +02:00
fn finish(&self) -> Outcome<T> {
Outcome::None
}
}
pub enum Outcome<T> {
None,
Some(T),
Chain(Box<dyn Operation<T>>),
}