pub struct ComponentDef {
pub name: String,
pub description: Option<String>,
pub props: BTreeMap<String, PropDef>,
pub required: Vec<String>,
pub allowed_parents: Option<Vec<String>>,
pub allowed_children: Option<Vec<String>>,
/* private fields */
}Expand description
One component type in a catalog.
Fields§
§name: StringType name, e.g. Text.
description: Option<String>Human-readable description, carried into generated prompts.
props: BTreeMap<String, PropDef>Properties, keyed by name.
required: Vec<String>Property names that must be present, in declaration order.
allowed_parents: Option<Vec<String>>Parent component types this may sit under. None means unrestricted.
SURFACE_COMPONENT stands for the
implicit surface container, so ["Surface"] restricts a component to
being the tree root.
allowed_children: Option<Vec<String>>Child component types this may contain. None means unrestricted.
Implementations§
Source§impl ComponentDef
impl ComponentDef
Sourcepub fn props_in_order(&self) -> impl Iterator<Item = &PropDef>
pub fn props_in_order(&self) -> impl Iterator<Item = &PropDef>
Properties in declaration order.
Sourcepub fn references(&self, component: &Component) -> Vec<ComponentRef>
pub fn references(&self, component: &Component) -> Vec<ComponentRef>
Every component id a concrete component of this type references.
Locators are relative to the component object, e.g. child,
children[2], children.componentId, tabs[0].child.
Trait Implementations§
Source§impl Clone for ComponentDef
impl Clone for ComponentDef
Source§fn clone(&self) -> ComponentDef
fn clone(&self) -> ComponentDef
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ComponentDef
impl Debug for ComponentDef
impl Eq for ComponentDef
Source§impl PartialEq for ComponentDef
impl PartialEq for ComponentDef
Source§fn eq(&self, other: &ComponentDef) -> bool
fn eq(&self, other: &ComponentDef) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ComponentDef
Auto Trait Implementations§
impl Freeze for ComponentDef
impl RefUnwindSafe for ComponentDef
impl Send for ComponentDef
impl Sync for ComponentDef
impl Unpin for ComponentDef
impl UnsafeUnpin for ComponentDef
impl UnwindSafe for ComponentDef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.