Struct slint_interpreter::ComponentDefinition
source · pub struct ComponentDefinition { /* private fields */ }
Expand description
ComponentDefinition is a representation of a compiled component from .slint markup.
It can be constructed from a .slint file using the ComponentCompiler::build_from_path
or ComponentCompiler::build_from_source
functions.
And then it can be instantiated with the Self::create
function.
The ComponentDefinition acts as a factory to create new instances. When you’ve finished creating the instances it is safe to drop the ComponentDefinition.
Implementations§
source§impl ComponentDefinition
impl ComponentDefinition
sourcepub fn create(&self) -> Result<ComponentInstance, PlatformError>
pub fn create(&self) -> Result<ComponentInstance, PlatformError>
Creates a new instance of the component and returns a shared handle to it.
sourcepub fn properties(&self) -> impl Iterator<Item = (String, ValueType)> + '_
pub fn properties(&self) -> impl Iterator<Item = (String, ValueType)> + '_
Returns an interator over all publicly declared properties. Each iterator item is a tuple of property name and property type for each of them.
sourcepub fn callbacks(&self) -> impl Iterator<Item = String> + '_
pub fn callbacks(&self) -> impl Iterator<Item = String> + '_
Returns the names of all publicly declared callbacks.
sourcepub fn globals(&self) -> impl Iterator<Item = String> + '_
pub fn globals(&self) -> impl Iterator<Item = String> + '_
Returns the names of all exported global singletons
Note: Only globals that are exported or re-exported from the main .slint file will be exposed in the API
sourcepub fn global_properties(
&self,
global_name: &str
) -> Option<impl Iterator<Item = (String, ValueType)> + '_>
pub fn global_properties( &self, global_name: &str ) -> Option<impl Iterator<Item = (String, ValueType)> + '_>
List of publicly declared properties in the exported global singleton specified by its name.
Trait Implementations§
source§impl Clone for ComponentDefinition
impl Clone for ComponentDefinition
source§fn clone(&self) -> ComponentDefinition
fn clone(&self) -> ComponentDefinition
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ComponentDefinition
impl !Send for ComponentDefinition
impl !Sync for ComponentDefinition
impl Unpin for ComponentDefinition
impl !UnwindSafe for ComponentDefinition
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.