pub trait EguiStruct: EguiStructClone + EguiStructEq {
type ConfigType<'a>: Default;
const SIMPLE: bool = true;
// Provided methods
fn has_childs(&self) -> bool { ... }
fn has_primitive(&self) -> bool { ... }
fn show_top(
&mut self,
ui: &mut Ui,
label: impl Into<WidgetText> + Clone,
reset2: Option<&Self>,
) -> Response
where Self: 'static { ... }
fn show_collapsing(
&mut self,
ui: &mut Ui,
label: impl Into<WidgetText> + Clone,
hint: impl Into<WidgetText> + Clone,
indent_level: isize,
config: Self::ConfigType<'_>,
reset2: Option<&Self>,
parent_id: Id,
) -> Response { ... }
fn show_primitive(
&mut self,
ui: &mut Ui,
_config: Self::ConfigType<'_>,
_id: impl Hash + Clone,
) -> Response { ... }
fn show_childs(
&mut self,
_ui: &mut Ui,
_indent_level: isize,
_response: Response,
_reset2: Option<&Self>,
_parent_id: Id,
) -> Response { ... }
fn start_collapsed(&self) -> bool { ... }
}Expand description
Trait, that allows generating mutable view of data (takes &mut data)
For end user (if you implement trait with macro & not manualy) ofers one function .show_top(), which displays struct inside scroll area.
Provided Associated Constants§
Required Associated Types§
Sourcetype ConfigType<'a>: Default
type ConfigType<'a>: Default
Type that will pass some data to customise how data is shown, in most cases this will be () (eg. for numerics this is ConfigNum)
Provided Methods§
Sourcefn has_childs(&self) -> bool
fn has_childs(&self) -> bool
Indicates if data has childs section at the moment
Sourcefn has_primitive(&self) -> bool
fn has_primitive(&self) -> bool
Indicates if data has primitive section at the moment
Sourcefn show_top(
&mut self,
ui: &mut Ui,
label: impl Into<WidgetText> + Clone,
reset2: Option<&Self>,
) -> Responsewhere
Self: 'static,
fn show_top(
&mut self,
ui: &mut Ui,
label: impl Into<WidgetText> + Clone,
reset2: Option<&Self>,
) -> Responsewhere
Self: 'static,
Show data in view contained ScrollArea&Grid
You should rather not need to override default impl
Sourcefn show_collapsing(
&mut self,
ui: &mut Ui,
label: impl Into<WidgetText> + Clone,
hint: impl Into<WidgetText> + Clone,
indent_level: isize,
config: Self::ConfigType<'_>,
reset2: Option<&Self>,
parent_id: Id,
) -> Response
fn show_collapsing( &mut self, ui: &mut Ui, label: impl Into<WidgetText> + Clone, hint: impl Into<WidgetText> + Clone, indent_level: isize, config: Self::ConfigType<'_>, reset2: Option<&Self>, parent_id: Id, ) -> Response
Do not overide this method.
Use it when implementing .show_childs() to display single nested element
Sourcefn show_primitive(
&mut self,
ui: &mut Ui,
_config: Self::ConfigType<'_>,
_id: impl Hash + Clone,
) -> Response
fn show_primitive( &mut self, ui: &mut Ui, _config: Self::ConfigType<'_>, _id: impl Hash + Clone, ) -> Response
UI elements shown in the same line as label
If data element view is fully contained in childs section(does not have primitive section), leave this & .has_primitive() with default impl
Sourcefn show_childs(
&mut self,
_ui: &mut Ui,
_indent_level: isize,
_response: Response,
_reset2: Option<&Self>,
_parent_id: Id,
) -> Response
fn show_childs( &mut self, _ui: &mut Ui, _indent_level: isize, _response: Response, _reset2: Option<&Self>, _parent_id: Id, ) -> Response
UI elements related to nested data, that is show inside collapsible rows
If data element view is simple & can fully be contained in primitive section, leave this & .has_childs() with default impl
Sourcefn start_collapsed(&self) -> bool
fn start_collapsed(&self) -> bool
Controls if struct is initally collapsed/uncollapsed (if “show_childs” is shown by default)
eg. Collections (vecs, slices, hashmaps, ..) are initially collapsed if they have more than 16 elements
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.