pub trait LayoutVisitor {
// Required method
fn layout_visitor(&mut self) -> Visitor<impl Visitable>;
}
Expand description
Macro-generated implementation of layout over a [Visitor
]
This method is implemented by the #widget
macro when a layout
specification is provided.
Direct implementations of this trait are not supported.
This trait may be used in user-code where a layout
specification is used
and custom behaviour is provided for one or more layout methods, for example:
use kas::prelude::*;
impl_scope! {
#[widget {
Data = ();
layout = "Example";
}]
struct Example {
core: widget_core!(),
}
impl Layout for Self {
fn size_rules(&mut self, sizer: SizeCx, axis: AxisInfo) -> SizeRules {
let mut rules = self.layout_visitor().size_rules(sizer, axis);
rules.set_stretch(Stretch::High);
rules
}
}
}
Required Methods§
Sourcefn layout_visitor(&mut self) -> Visitor<impl Visitable>
fn layout_visitor(&mut self) -> Visitor<impl Visitable>
Layout defined by a [Visitor
]
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.