Skip to main content

Queryable

Trait Queryable 

Source
pub trait Queryable {
    // Required method
    fn get_property(&self, key: &str) -> Option<PropertyValue>;

    // Provided method
    fn set_property(&mut self, key: &str, value: PropertyValue) -> bool { ... }
}
Expand description

Per-widget, identity-free property accessor trait.

Widgets that want creator or playit introspection implement this trait. The trait is deliberately decoupled from object identity (no ObjectNode reference, no global registry) — callers hold the widget directly and call get_property / set_property on it. This satisfies the LPAR-00 §9 mandate while deferring any object-identity dependency to LPAR-02/04.

§Key strings

Key strings follow LVGL naming conventions. Each widget defines its own set; unknown keys return None / false without panicking. A typed key enum per widget is a Specification Required addition that does not require changes to this trait.

§Default set_property

Read-only widgets need not override set_property; the default returns false for every key.

Required Methods§

Source

fn get_property(&self, key: &str) -> Option<PropertyValue>

Read a named property value.

Returns None if the key is unknown. Implementations MUST NOT panic on unrecognised keys.

Provided Methods§

Source

fn set_property(&mut self, key: &str, value: PropertyValue) -> bool

Write a named property value.

Returns true if the property was recognised and the supplied value was of the correct type and applied successfully. Returns false for unknown keys and for type mismatches — in the latter case the widget state MUST NOT be corrupted.

The default implementation returns false for every key, making the trait safe to impl on read-only widgets without an override.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§