Skip to main content

Bindable

Trait Bindable 

Source
pub trait Bindable: Component {
    type Value: Into<PropertyValue> + From<PropertyValue>;

    const NAME: &'static str;

    // Required methods
    fn read(&self) -> Self::Value;
    fn write(&mut self, v: Self::Value);
}
Expand description

Declares that a Component participates in the entity-property bus exposed by crate::property_store::PropertyStore.

The intent is to collapse the BindText / BindChecked / BindValue zoo onto a single, type-erased property pipeline. The trait defines the shape; there is no registration call on crate::app::App yet, so implementing it does not wire anything up, and no component in the workspace implements it yet. The shape it is designed for is crate::components::TextContent (NAME = "text", Value = Arc<str>).

Required Associated Constants§

Source

const NAME: &'static str

Bus name for this component. Markup bind-<NAME>="signal" wires PropertyKey::Entity(e, NAME) to PropertyKey::Global("signal").

Required Associated Types§

Source

type Value: Into<PropertyValue> + From<PropertyValue>

Typed value carried over the bus. Must round-trip through PropertyValue.

Required Methods§

Source

fn read(&self) -> Self::Value

Reads the component into its bus value.

Source

fn write(&mut self, v: Self::Value)

Writes a bus value into the component.

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.

Implementors§

Source§

impl Bindable for TextContent

Source§

const NAME: &'static str = "text"

Source§

type Value = Arc<str>