diff --git a/src/lib.rs b/src/lib.rs index 1bf8ac2..92d0b69 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1316,16 +1316,6 @@ pub trait AsMutOpt { fn as_mut_opt (&mut self) -> Option<&mut T>; } /// Drawable that supports dynamic dispatch. /// - /// Drawables are composable, e.g. the [when] and [either] conditionals - /// or the layout constraints. - /// - /// Drawables are consumable, i.e. the [Draw::draw] method receives an - /// owned `self` and does not return it, consuming the drawable. - /// - /// To draw a thing multiple times, instead of explicitly constructing it - /// every time, implement the [View] trait instead, which will construct - /// a [Draw]able. - /// /// ``` /// use tengri::*; /// struct MyWidget(bool); @@ -1339,39 +1329,6 @@ pub trait AsMutOpt { fn as_mut_opt (&mut self) -> Option<&mut T>; } fn draw (&self, to: &mut S) -> Drawn; } - ///// Emit a [Draw]able. - ///// - ///// Speculative. How to avoid conflicts with [Draw] proper? - //pub trait View { - //fn view (&self) -> impl Draw ; - //} - - //impl View for () { - //fn view (&self) -> impl Draw { - //() - //} - //} - - ///// Return a [Draw]able. - ///// - ///// ``` - ///// # use tengri::*; - ///// let _ = view::(||"drawable"); - ///// let _ = view::(||Some("drawable")); - ///// ``` - //pub const fn view Draw, F: Fn()->T> (view: F) -> impl View { - //ViewThunk(view, PhantomData) - //} - - ///// Because we can't implement [Draw] for `F: FnOnce...` without conflicts. - //pub struct ViewThunk(pub F, std::marker::PhantomData); - - //impl Draw, F: Fn()->T> View for ViewThunk { - //fn view (&self) -> impl Draw { - //self.0() - //} - //} - /// Because we can't implement [Draw] for `F: FnOnce...` without conflicts. pub struct DrawThunk(pub F, std::marker::PhantomData); @@ -1646,7 +1603,6 @@ pub trait AsMutOpt { fn as_mut_opt (&mut self) -> Option<&mut T>; } #[cfg(feature = "draw")] pub use self::color::*; #[cfg(feature = "draw")] mod color { use crate::*; - use dizzle::LanguageErrorKind::*; use ::ratatui::style::Color; use ::rand::distributions::uniform::UniformSampler; pub(crate) use ::palette::{