EguiStruct

Trait EguiStruct 

Source
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§

Source

const SIMPLE: bool = true

Flag that indicates that data can be shown in the same line as parent (set to true if data is shown as single&simple widget)

Required Associated Types§

Source

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§

Source

fn has_childs(&self) -> bool

Indicates if data has childs section at the moment

Source

fn has_primitive(&self) -> bool

Indicates if data has primitive section at the moment

Source

fn show_top( &mut self, ui: &mut Ui, label: impl Into<WidgetText> + Clone, reset2: Option<&Self>, ) -> Response
where Self: 'static,

Show data in view contained ScrollArea&Grid

You should rather not need to override default impl

Source

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

Source

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

Source

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

Source

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.

Implementations on Foreign Types§

Source§

impl EguiStruct for bool

Source§

type ConfigType<'a> = ()

Source§

fn show_primitive( &mut self, ui: &mut Ui, _config: Self::ConfigType<'_>, _id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for f32

Source§

type ConfigType<'a> = ConfigNum<'a, f32>

Source§

fn show_primitive( &mut self, ui: &mut Ui, config: Self::ConfigType<'_>, id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for f64

Source§

type ConfigType<'a> = ConfigNum<'a, f64>

Source§

fn show_primitive( &mut self, ui: &mut Ui, config: Self::ConfigType<'_>, id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for i8

Source§

type ConfigType<'a> = ConfigNum<'a, i8>

Source§

fn show_primitive( &mut self, ui: &mut Ui, config: Self::ConfigType<'_>, id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for i16

Source§

type ConfigType<'a> = ConfigNum<'a, i16>

Source§

fn show_primitive( &mut self, ui: &mut Ui, config: Self::ConfigType<'_>, id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for i32

Source§

type ConfigType<'a> = ConfigNum<'a, i32>

Source§

fn show_primitive( &mut self, ui: &mut Ui, config: Self::ConfigType<'_>, id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for i64

Source§

type ConfigType<'a> = ConfigNum<'a, i64>

Source§

fn show_primitive( &mut self, ui: &mut Ui, config: Self::ConfigType<'_>, id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for i128

Source§

type ConfigType<'a> = ()

Source§

fn show_primitive( &mut self, ui: &mut Ui, _config: Self::ConfigType<'_>, _id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for isize

Source§

type ConfigType<'a> = ConfigNum<'a, isize>

Source§

fn show_primitive( &mut self, ui: &mut Ui, config: Self::ConfigType<'_>, id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for u8

Source§

type ConfigType<'a> = ConfigNum<'a, u8>

Source§

fn show_primitive( &mut self, ui: &mut Ui, config: Self::ConfigType<'_>, id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for u16

Source§

type ConfigType<'a> = ConfigNum<'a, u16>

Source§

fn show_primitive( &mut self, ui: &mut Ui, config: Self::ConfigType<'_>, id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for u32

Source§

type ConfigType<'a> = ConfigNum<'a, u32>

Source§

fn show_primitive( &mut self, ui: &mut Ui, config: Self::ConfigType<'_>, id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for u64

Source§

type ConfigType<'a> = ConfigNum<'a, u64>

Source§

fn show_primitive( &mut self, ui: &mut Ui, config: Self::ConfigType<'_>, id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for u128

Source§

type ConfigType<'a> = ()

Source§

fn show_primitive( &mut self, ui: &mut Ui, _config: Self::ConfigType<'_>, _id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for usize

Source§

type ConfigType<'a> = ConfigNum<'a, usize>

Source§

fn show_primitive( &mut self, ui: &mut Ui, config: Self::ConfigType<'_>, id: impl Hash + Clone, ) -> Response

Source§

impl EguiStruct for String

Source§

type ConfigType<'a> = ConfigStr<'a>

Source§

fn show_primitive( &mut self, ui: &mut Ui, config: Self::ConfigType<'_>, id: impl Hash + Clone, ) -> Response

Source§

impl<Q: ToString + Eq + Hash, V: EguiStruct> EguiStruct for HashMap<Q, V>

Source§

const SIMPLE: bool = false

Source§

type ConfigType<'a> = ()

Source§

fn has_childs(&self) -> bool

Source§

fn has_primitive(&self) -> bool

Source§

fn show_childs( &mut self, ui: &mut Ui, indent_level: isize, response: Response, _reset2: Option<&Self>, id: Id, ) -> Response

Source§

fn start_collapsed(&self) -> bool

Source§

impl<T: EguiStruct + Default> EguiStruct for Option<T>

Source§

const SIMPLE: bool = false

Source§

type ConfigType<'a> = ()

Source§

fn has_childs(&self) -> bool

Source§

fn has_primitive(&self) -> bool

Source§

fn show_primitive( &mut self, ui: &mut Ui, _config: Self::ConfigType<'_>, id: impl Hash + Clone, ) -> Response

Source§

fn show_childs( &mut self, ui: &mut Ui, indent_level: isize, response: Response, reset2: Option<&Self>, id: Id, ) -> Response

Source§

impl<T: EguiStruct> EguiStruct for [T]

Source§

const SIMPLE: bool = false

Source§

type ConfigType<'a> = ()

Source§

fn has_childs(&self) -> bool

Source§

fn has_primitive(&self) -> bool

Source§

fn show_childs( &mut self, ui: &mut Ui, indent_level: isize, response: Response, _reset2: Option<&Self>, id: Id, ) -> Response

Source§

fn start_collapsed(&self) -> bool

Source§

impl<T: EguiStruct> EguiStruct for Vec<T>

Source§

const SIMPLE: bool = false

Source§

type ConfigType<'a> = ()

Source§

fn has_childs(&self) -> bool

Source§

fn has_primitive(&self) -> bool

Source§

fn show_childs( &mut self, ui: &mut Ui, indent_level: isize, response: Response, _reset2: Option<&Self>, id: Id, ) -> Response

Source§

fn start_collapsed(&self) -> bool

Implementors§

Source§

impl<T: Clone + ToString + PartialEq + 'static> EguiStruct for Combobox<T>

Source§

type ConfigType<'a> = Option<&'a mut dyn Iterator<Item = T>>