Trait Source
pub trait Source {
// Required methods
fn key(&self) -> &str;
fn prop(&mut self, name: &str) -> Option<Value>;
fn event(&mut self, name: &str) -> Event;
fn binding(&mut self, name: &str) -> Option<BoundValue>;
fn children(&mut self, slot: &str) -> Vec<Box<dyn Widget>>;
fn components(
&mut self,
slot: &str,
read: &mut dyn FnMut(&mut dyn Source) -> Result<(), String>,
) -> Result<usize, String>;
// Provided methods
fn state(&mut self, name: &str) -> Option<Value> { ... }
fn slot_kinds(&mut self, slot: &str) -> Vec<Option<String>> { ... }
fn rows(&mut self, slot: &str) -> Option<Rc<RefCell<dyn RowSource>>> { ... }
}Expand description
An instance of a component as its host gives it: the values of its props, its events and bindings as data, and its slots’ content.
Required Methods§
fn prop(&mut self, name: &str) -> Option<Value>
fn prop(&mut self, name: &str) -> Option<Value>
The value of the prop name, when the instance gives it.
fn event(&mut self, name: &str) -> Event
fn event(&mut self, name: &str) -> Event
What the event name does: Event::None when the instance gives it nothing.
fn binding(&mut self, name: &str) -> Option<BoundValue>
fn binding(&mut self, name: &str) -> Option<BoundValue>
The binding name, when the instance binds it.
Provided Methods§
fn state(&mut self, name: &str) -> Option<Value>
fn state(&mut self, name: &str) -> Option<Value>
The widget state name to restore, when there is some.
fn slot_kinds(&mut self, slot: &str) -> Vec<Option<String>>
fn slot_kinds(&mut self, slot: &str) -> Vec<Option<String>>
The component each child of the slot slot is an instance of, in order: None for a
child that is a view of another kind.