ZIm/crates/ui2/src/element_ext.rs
2023-10-26 15:20:38 +02:00

25 lines
613 B
Rust

use gpui2::Element;
pub trait ElementExt<S: 'static>: Element<S> {
// fn when(mut self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
// where
// Self: Sized,
// {
// if condition {
// self = then(self);
// }
// self
// }
// fn when_some<T, U>(mut self, option: Option<T>, then: impl FnOnce(Self, T) -> U) -> U
// where
// Self: Sized,
// {
// if let Some(value) = option {
// self = then(self, value);
// }
// self
// }
}
impl<S: 'static, E: Element<S>> ElementExt<S> for E {}