element_ext.rs

 1use gpui2::Element;
 2
 3pub trait ElementExt<S: 'static>: Element<S> {
 4    // fn when(mut self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
 5    // where
 6    //     Self: Sized,
 7    // {
 8    //     if condition {
 9    //         self = then(self);
10    //     }
11    //     self
12    // }
13
14    // fn when_some<T, U>(mut self, option: Option<T>, then: impl FnOnce(Self, T) -> U) -> U
15    // where
16    //     Self: Sized,
17    // {
18    //     if let Some(value) = option {
19    //         self = then(self, value);
20    //     }
21    //     self
22    // }
23}
24
25impl<S: 'static, E: Element<S>> ElementExt<S> for E {}