#![feature(step_trait)] #![feature(type_alias_impl_trait)] #![feature(impl_trait_in_assoc_type)] #![feature(const_precise_live_drops)] #![feature(type_changing_struct_update)] //#![feature(non_lifetime_binders)] mod content; pub use self::content::*; mod draw; pub use self::draw::*; mod group; pub use self::group::*; mod layout; pub use self::layout::*; mod space; pub use self::space::*; mod thunk; pub use self::thunk::*; mod widget; pub use self::widget::*; pub(crate) use self::Direction::*; pub(crate) use std::fmt::{Debug, Display}; pub(crate) use std::marker::PhantomData; pub(crate) use std::ops::{Add, Sub, Mul, Div}; pub(crate) use std::sync::{Arc, RwLock, atomic::{AtomicUsize, Ordering::Relaxed}}; pub(crate) use tengri_core::*; /// Draw target. pub trait Out: Send + Sync + Sized { /// Unit of length type Unit: Coordinate; /// Rectangle without offset type Size: Size; /// Rectangle with offset type Area: Area; /// Current output area fn area (&self) -> Self::Area; /// Mutable pointer to area fn area_mut (&mut self) -> &mut Self::Area; /// Draw widget in area fn place_at <'t, T: Draw + ?Sized> (&mut self, area: Self::Area, content: &'t T); fn place <'t, T: Draw + Layout + ?Sized> (&mut self, content: &'t T) { self.place_at(content.layout(self.area()), content) } #[inline] fn x (&self) -> Self::Unit { self.area().x() } #[inline] fn y (&self) -> Self::Unit { self.area().y() } #[inline] fn w (&self) -> Self::Unit { self.area().w() } #[inline] fn h (&self) -> Self::Unit { self.area().h() } #[inline] fn wh (&self) -> Self::Size { self.area().wh().into() } } #[cfg(test)] mod test; #[cfg(test)] pub(crate) use proptest_derive::Arbitrary; //impl + Layout> Draw for C { // if only //fn draw (&self, to: &mut E) { //if let Some(content) = self.content() { //to.place_at(self.layout(to.area()), &content); //} //} //}