pub trait CotisLayoutCompatible<'name> {
// Required methods
fn get_style(&self) -> LayoutElementConfig;
fn get_id(&self) -> ElementId;
fn try_get_name(&self) -> Option<OwnedOrRef<'name, str>>;
}Expand description
Maps a user-facing element config into layout-engine data.
Called when ConfigureElements::set_config
is invoked on a CotisLayoutRun. The layout style is
extracted and stored on the internal tree node; the original config is retained for render
command emission.
Custom config authors typically implement this alongside TextConfigurable
when text leaves are needed.
§Examples
use cotis::utils::ElementIdConfig;
use cotis_layout::layout_traits::CotisLayoutCompatible;
use cotis_defaults::element_configs::premade_configs::GenericElementConfig;
type MyConfig = GenericElementConfig<'static, (), ()>;
let config = MyConfig {
id_config: ElementIdConfig::new_empty(),
style: Default::default(),
image: None,
custom: None,
extra_data: None,
};
let _id = CotisLayoutCompatible::get_id(&config);
let _name = CotisLayoutCompatible::try_get_name(&config);Required Methods§
Sourcefn get_style(&self) -> LayoutElementConfig
fn get_style(&self) -> LayoutElementConfig
Layout style derived from this config (padding, sizing, clip, float, etc.).
Sourcefn get_id(&self) -> ElementId
fn get_id(&self) -> ElementId
Stable element identifier used for tree nodes and render commands.
Sourcefn try_get_name(&self) -> Option<OwnedOrRef<'name, str>>
fn try_get_name(&self) -> Option<OwnedOrRef<'name, str>>
Optional debug name appended to the internal layout node.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".